Is there an advantage in grouping css media queries together?

A bit late to the party, but based on the tests below the performance impact seems to be minimal. The test shows the rendering times for an example page with 2000 separate and combined media queries, respectively. http://aaronjensen.github.com/media_query_test/ The main benefit seems to be in file size more than anything else – which, if you’re … Read more

Require statement in application.css.scss

application.css.scss or application.css are kinda the same. Just rename your application.css to application.css.scss. As for adding that line, it’ll need to be right up the top, in a comment. Like this: /* * This is a manifest file that’ll be compiled into application.css, which will include all the files * listed below. * * Any … Read more

Yarn – Node Sass does not yet support my current environment

I’m using OSX latest version(10.14.4 (18E226)) and node 12. While using node-sass 4.11, I had g++ error(../src/create_string.cpp:17:25: error: no matching constructor for initialization of ‘v8::String::Utf8Value’) while trying npm install, npm rebuild(link) which did not work. I solved this by updating node-sass to 4.12(npm install node-sass), as the github issue on the node-sass says that support … Read more

Using scss as default style sheet in Angular 6+ (styleExt)

The position on which this is set changed in the angular.json. There are 2 ways to set this option now. Via the Angular CLI: ng config schematics.@schematics/angular:component.styleext scss Directly in the angular.json: “schematics”: { “@schematics/angular:component”: { “styleext”: “scss” } } Angular 9 Update: Note that from Angular 9 onwards styleext is renamed to style. So … Read more

SCSS/CSS selector to select all input types

There are a lot of possible input types. If you want textareas and any input that has a type attribute then… textarea, input[type] { … } If you want to exclude some input types then use the :not selector. EDIT EXAMPLE JSFIDDLE http://jsfiddle.net/Pnbb8/ textarea, input[type]:not([type=search]):not([type=url]):not([type=hidden]) { } But like I said there are probably a … Read more

What does % mean in SASS?

https://sass-lang.com/documentation/style-rules/placeholder-selectors Placeholder Selectors: %foo Sass supports a special type of selector called a “placeholder selector”. These look like class and id selectors, except the # or . is replaced by %. They’re meant to be used with the @extend directive; for more information see @extend-Only Selectors. On their own, without any use of @extend, rulesets … Read more

Sass – Class name wildcard

In CSS you can use the attribute selector with ^: div[class^=”div-“] ==> Selects all div with a class attribute value starting with “div-“ Example: div { height: 20px; margin-bottom: 5px; border: 1px solid black; } div[class^=”div-“] { border-color: red; } <div class=”div-one”></div> <div class=”div-two”></div> <div class=”other”></div> <div class=”div-three”></div> Update As @FreePender says, if the CSS … Read more