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

Cannot find module ‘sass’

To note! node-sass is deprecated as by now! Warning: LibSass and Node Sass are deprecated. While they will continue to receive maintenance releases indefinitely, there are no plans to add additional features or compatibility with any new CSS or Sass features. Projects that still use it should move onto Dart Sass. Instead you can see … Read more

SASS CSS: Target Parent Class from Child

As of Sass 3.4, this is now supported. The syntax looks like this: .message-error { background-color: red; @at-root p#{&} { background-color: yellow } } Note the @at-root directive and the interpolation syntax on the ampersand. Failure to include the @at-root directive will result in a selector like .message-error p.message-error rather than p.message-error.

Styling a specific set of input types in a reusable way with Sass

Your problem might better be solved by using variables to contain your selectors. By using a mixin, you’re losing the ability to chain it with similar elements. $form-input-text: ‘input[type=”text”], input[type=”password”], input[type=”search”], input[type=”email”], input[type=”tel”], input[type=”url”]’; $form-input-buttons: ‘input[type=”submit”], input[type=”reset”], input[type=”button”], button’; $form-input-dates: ‘input[type^=”date”], input[type=”month”], input[type=”week”], input[type=”time”]’; $form-input-not-radio: ‘input:not([type=”radio”]):not([type=”checkbox”])’; #{$form-input-text}, textarea { @include border-radius(.25em); border: $form-input-border; } #{$form-input-text}, … Read more

Unable to override $theme-color in bootstrap

Update 2021 for Bootstrap 5 Per the guidance in the docs… “Variable overrides must come after our functions are imported, but before the rest of the imports.” Therefore, overriding the theme-colors in Bootstrap 5 works the same way as 4.x. In order to override the theme-colors, simply change appropriate theme color variable before importing bootstrap.scss … Read more

Unexpected results when using @extend for themes

Extends, as you’ve already discovered, can get rather messy. I would go about solving your problem by using an @content aware mixin in combination with global variables (this uses mappings, which are part of 3.3… you can do it with lists of lists, but it’s a little less elegant): $base-color: null; // don’t touch $accent-color: … Read more

SASS calculate HSL Difference between 2 colours

You can check out the following resource: Building Color Palettes with SASS Basically, here’s the meat of it: @function color-diff($a, $b) { $sat: saturation($a) – saturation($b); $lig: lightness($a) – lightness($b); $fn-sat: if($sat > 0, ‘desaturate’, ‘saturate’); $fn-lig: if($lig > 0, ‘darken’, ‘lighten’); @return ( adjust-hue: -(hue($a) – hue($b)), #{$fn-sat}: abs($sat), #{$fn-lig}: abs($lig) ); } You … Read more