문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top