First we’ll configure Rails, assuming you already have a copy of google-maps-utility-library-v3 in your repo. If you don’t have it yet, there are instructions in the bottom.
Most likely, you already have added utility folder to the assets pipeline:
# config/initializer/assets.rb
Rails.application.config.assets.paths += %W(
#{Rails.root}/vendor/assets/google-maps-utility-library-v3
)
Tell sprockets you want it to compile images too:
# config/initializer/assets.rb
Rails.application.config.assets.precompile += %w(
markerclustererplus/images/*.png
)
Configure MarkerClusterer to use self-hosted images.
#= require markerclustererplus/src/markerclusterer_packed.js
#= require infobox/src/infobox_packed.js
# ... require anything you want
MarkerClusterer.IMAGE_PATH = '/assets/markerclustererplus/images/m'
That’s all. Continue reading if you don’t had a copy of utility library yet.
I use git submodules to add google-maps-utility-library-v3 to the repo:
git submodule add \
https://github.com/printercu/google-maps-utility-library-v3-read-only.git \
vendor/assets/google-maps-utility-library-v3
Don’t forget to configure your deployment. After checkout run:
git submodule init
git submodule sync
git submodule update — init
And you’re ready for deploy.
You can try to find bower package or just check-in all the files to your repo if you don’t want to deal with submodules.