0

I used to put everything into application.css before and it worked. But now I wanted to use some nice dropdown menus in my app and the css for it is huuge. So I made a new css file just for the dropdown menus in the same folder where application.css is: stylesheets

It seems now that rails does not load the newly created css file. How can I make it load every file in the folder?

3
  • What is the content of your application.css? Commented Jan 17, 2014 at 19:23
  • Before, it had all my css, now it's empty as I moved everything into a seperate file. I imagine it needs to include some code to fetch every other file in the tree? If so, what is it? Commented Jan 17, 2014 at 19:25
  • Yes, you need to include the code to load all other files. I post it as an answer. Commented Jan 17, 2014 at 19:28

2 Answers 2

2

Use the default application.css file, it includes all .css files in the assets directories:

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * 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_tree .
 */
Sign up to request clarification or add additional context in comments.

Comments

1

put those two lines into application.css:

*= require_self
*= require_tree .

*= require tree . will require all css files in app/assets/stylesheets , lib/assets/stylesheets and vendor/assets/stylesheets

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.