Question

When a rails app is created with rails 3.1 or 3.2.0.rc2 it by default creates an app/assets/stylesheets/application.css file, however each controller/model created there after creates an app/assets/stylesheets/<controller or model name>.scss.

Why isn't an application.scss created by default?

How do you properly incorporate an application.scss and get rid of the application.css entirely?

Was it helpful?

Solution

I would just rename it to application.scss and then you can import in your other .scss files like this:

// Inside application.scss

// HTML Reset
@import "reset.scss";

// Users CSS
@import "users.scss";

When you compile the SCSS, it will generate the application.css for you from all of the other imported files or CSS within that file.

OTHER TIPS

application.css just plays like a house keeper, it represents the correct order of other .scss files.

Put the real working CSS in application.css may not good practice, as the comment generated by rails below:

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top