apneadiving / Google-Maps-for-Rails

Enables easy Google map + overlays creation in Ruby apps
https://apneadiving.github.io/
MIT License
2.26k stars 382 forks source link

gmaps4rails.css in 3.1 asset pipeline #159

Closed rboyd closed 12 years ago

rboyd commented 12 years ago

shouldn't /public/stylesheets/gmaps4rails.css also be in /app/assets/stylesheets/ to be available for the pipeline?

I include from one of my app asset scss files as:

//= require gmaps4rails

Which would break during assets precompilation before I copied. I can't figure out what the README.rdoc is trying to recommend with the backtick require gmaps4rails but it surely wasn't making it into my compiled application css until I did the above.

Am I misunderstanding something?

apneadiving commented 12 years ago

Can't understand, seems it disappeared from assets...

I'll correct very soon, in the meantime, here is the file: https://github.com/apneadiving/Google-Maps-for-Rails/blob/master/public/stylesheets/gmaps4rails.css

apneadiving commented 12 years ago

public/stylesheets is added to the pipeine in https://github.com/apneadiving/Google-Maps-for-Rails/blob/master/lib/gmaps4rails.rb

Could you please tell me more about the bug?

rboyd commented 12 years ago

I took another look this morning and I'm pretty sure this is related to me having config.assets.initialize_on_precompile set to false (which is necessary for a heroku deployment). I think this will just work if I add gmaps4rails/public/stylesheets to config.assets.precompile directory list.

I'll report back tonight.

rboyd commented 12 years ago

Ok, I found out what's going on. My idea of adding the css file to the precompile list will work except that public/stylesheets doesn't make it into the asset path since config.assets.initialize_on_precompile is set to false (again, because of Heroku deployment).

One workaround is to add the path in config/environments/production.rb just before targeting the stylesheet for precompilation:

config.assets.paths << "#{Gmaps4rails::Engine.config.root}/public/stylesheets"
config.assets.precompile << "gmaps4rails.css"

This might be a useful addition to the wiki and is similarly reported in other gems like rails_admin

apneadiving commented 12 years ago

Very interesting point, I'll add it to the readme or wiki. Thanks for sharing.

Sent from my iPhone

On 14 mars 2012, at 02:54, Robert Boydreply@reply.github.com wrote:

Ok, I found out what's going on. My idea of adding the css file to the precompile list will work except that public/stylesheets doesn't make it into the asset path since config.assets.initialize_on_precompile is set to false (again, because of Heroku deployment).

One workaround is to add the path in config/environments/production.rb just before targeting the stylesheet for precompilation:

config.assets.paths << "#{Gmaps4rails::Engine.config.root}/public/stylesheets"
config.assets.precompile << "gmaps4rails.css"

This might be a useful addition to the wiki and is similarly reported in other gems like rails_admin


Reply to this email directly or view it on GitHub: https://github.com/apneadiving/Google-Maps-for-Rails/issues/159#issuecomment-4490728

apneadiving commented 12 years ago

I've added it here: https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Known-Issues

Thanks :)