CSS preprocessor
@mixin mobile-only {
@media (max-width: $mobile-width) {
@content;
}
}
.root {
@include mobile-only {
display: none;
}
}
@function spacing($space) {
@if $space == 4 {
@return "4px";
} @else if $space == 8 {
@return "8px";
}
...
}
.root {
padding: spacing(4);
}
Locally scoped CSS
Component1.scss
.root {
color: red;
}
Component2.scss
.root {
color: green;
}
.root { color: red; }
to
.root-h2l5l { color: red; }
import styles from './Component.module.scss';
A helper package for common className requirements
Utility-first CSS framework
Elements are styled using utility CSS classes.
Extending CSS with JS features
There are different CSS in JS approaches, e.g.:
We learned…