Why do rails 3.1 and 3.2.0.rc2 create application.css instead of scss?

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

Why is application.scss not created by default?

How do you properly enable application.scss and completely get rid of application.css ?

+4
source share
2 answers

I would just rename it to application.scss , and then you can import into your other .scss files:

 // Inside application.scss // HTML Reset @import "reset.scss"; // Users CSS @import "users.scss"; 

When compiling SCSS, it will generate application.css for you from all other imported files or CSS in this file.

+3
source

application.css just plays as the keeper of the house, it presents the correct order of other .scss files.

Putting real working CSS in application.css may not be very good practice, as the comment created by the rails below:

You can add all the styles of the application to this style, and they will appear at the top of the compiled file, but usually it’s better to create a new file for each style area.

+1
source

Source: https://habr.com/ru/post/1391377/


All Articles