|
|
|
|
|
by pg_bot
3021 days ago
|
|
There is a different and IMO better way to solve the global scope problem in CSS. Adapted from the Paul Irish method of executing JS you can use data attributes to conditionally write CSS. For example a new user controller would output the controller and action names as data attributes on the body. I then have a separate css file under `assets/users/new.scss` which only contains css for that page. Your Sass code looks something like: [data-controller="user_controller"][data-action="new"] {
.header {
background-color: blue;
}
}
This method keeps you organized and completely removes the biggest problem most people have with CSS. |
|