Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3.1 Load css in particular order

I see that in development environment in rails 3.1 the css are loaded in alphabetic order and not in the order I want. I want a particular css file to be at the end so it over-writes any styles given to the class before. How can we achieve that?

like image 404
phoenixwizard Avatar asked Jan 17 '12 07:01

phoenixwizard


2 Answers

You can actually do something like:

/* 
 *= require 'reset'
 *= require_self
 *= require_tree .
*/

in your application.css file. This allows you to specify any number of stylesheets, such as a reset, to come before the tree without having to specify each individual file. The single quotes around reset are optional.

Not trying to resurrect an old thread, just thought this might be helpful for some.

like image 56
graytist Avatar answered Nov 01 '22 03:11

graytist


It is better to specify the order of each and every files manually:

/*
 * This is a manifest file that'll automatically include all the stylesheets available in this directory
 * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
 * the top of the compiled file, but it's generally better to create a new file per style scope.
 *= require_self
 *= require reset
 *= require groups
 *= require the_last
*
like image 39
Arun Kumar Arjunan Avatar answered Nov 01 '22 02:11

Arun Kumar Arjunan