I use Twitter Bootstrap (not that that matters but it's a third party CSS file). Because it's a third party CSS "library" it should go in /vendor/assets/stylesheets
. So far so good.
Now, I would like to concatenate all CSS in one application.css in production using the Rails 3.1(.1) asset pipeline and that's where I get stuck.
When I run rake assets:precompile
it works as advertised. The Rake task creates a few application.css files in the public/assets
folder with the digest and all. Problem is this file only contains the CSS from my CSS files in /app/assets/stylesheets
and completely ignores the one in my vendor assets folder.
Does anyone know what I miss here and how I can tell Rails to concatenate the vendor stylesheet together with the app one(s)? Also, is it enough to only include:
<%= stylesheet_link_tag "application" %>
in the view (as I expect everything to be in one file in the end) or should I include every single CSS file?
To compile your assets locally, run the assets:precompile task locally on your app. Make sure to use the production environment so that the production version of your assets are generated. A public/assets directory will be created. Inside this directory you'll find a manifest.
1 What is the Asset Pipeline? The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages and pre-processors such as CoffeeScript, Sass, and ERB.
Place stylesheets in app/assets/stylesheets/ if they are specific to your application. You can also put them at vendor/assets/stylesheets/ if they are external (say if they are stylesheets for a javascript plugin.) After that, you will include stylesheets using the app/assets/stylesheets/application.
Two cleanup tasks: rake assets:clean is now a safe cleanup that only removes older assets that are no longer used, while rake assets:clobber nukes the entire public/assets directory. The clean task allows for rolling deploys that may still be linking to an old asset while the new assets are being built.
I have exactly your configuration, it works fine. Are you sure you're requiring bootstrap in your application.css? Like:
/*
*= require bootstrap
*= require_self
*/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With