If you have config.assets.compile set to true (typical for development) the 
stylesheet_link_tag will attempt to look in your app/assets directory and 
compile the css file if necessary. But the stylesheet_link_tag doesn't look 
outside public/assets in when config.assets.compile is set to false (which 
is typical for production). Actually, it reads from the manifest.yml to 
determine which file path to return.

When an asset is precompiled, it gets put into the public/assets directory 
and an entry is put in manifest.yml like so:

application.css: application-ccb8034635849c44627859332fda6a01.css

When you use stylesheet_link_tag("application") in production, it checks to 
see if an entry exists in manifest.yml with that name. if so, it returns the 
hashed filename specified in the manifest. Otherwise it would just return 
the unhashed file name like "assets/application.css"

So one option is to add bootstrap.css to config.assets.precompile. This 
will in fact send it through the pipeline and dump it in public/assets with 
the name bootstrap-digest.css and put an entry in manifest.yml.

However, plain CSS files don't really *need *to be pre-compiled since they 
don't contain SASS/ERB. If it doesn't need to be compiled, you can just put 
them directly in public/assets without adding it to config.assets.precompile 
and you're done.

So to sum it up: in production, all assets need to be under public/assets. 
How they get there depends on whether they need to be pre-processed or not.

Hopefully that's not too confusing. It sounds complicated but once you 
understand what's going on it's really kind of nifty.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/5n_dB2nZuGwJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to