Vendor CSS stylesheets in Rails 3.1 and the asset pipeline

Cimm picture Cimm · Oct 9, 2011 · Viewed 7.3k times · Source

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?

Answer

lucapette picture lucapette · Oct 9, 2011

I have exactly your configuration, it works fine. Are you sure you're requiring bootstrap in your application.css? Like:

/*
*= require bootstrap
*= require_self
*/