1

In my Rails project I have 3 .css files:

application.css

bootstrap.css

todo.scss

If I wanted to add another .css library is there a way of controlling the order the .css files are read when .require_tree is called in application.css.

Also how does Rails know to load load bootstrap.css before todo.scss so that bootstrap does not overide the specific View scope styling in todo.scss?

Community
  • 1
  • 1
Cu1ture
  • 1,273
  • 1
  • 14
  • 29
  • possible duplicate of [Rails 3.1 Load css in particular order](http://stackoverflow.com/questions/8890929/rails-3-1-load-css-in-particular-order) – pdobb Jul 28 '14 at 11:30

1 Answers1

1

SCSS

I believe the require_tree directive loads the files in alphabetical order

If you want to load the files in your own order, you may be interested in looking into using the @import functionality of scss (the Rails default CSS preprocessor)

You'll be able to do the following:

#app/assets/stylesheets/application.css.scss
@import bootstrap
@import todo
@import **/* /* Directory Globbing ;-) */

--

This will allow you to load the individual files / directories you require in the order you require

Richard Peck
  • 76,116
  • 9
  • 93
  • 147