Search code examples
ruby-on-railsimportsassstylesheet

How to make Rails not import every file from app/assets/stylesheets?


In app/assets/stylesheets, I have many sass files. In a requested page, every file in app/assets/stylesheets is imported (with a tag). How do I make it so that not every file from the directory is imported, but only the ones that I pick?

Note: I'm running Rails 4.1.2


Solution

  • You change your app/assets/stylesheets/application.css file.

    Instead of *=require_tree .

    Add:

    *=require './file1' 
    *=require './file2'
    ...
    

    You don't need to supply .css or .css.scss