Providing features that don't exist (or haven't existed) natively in CSS. For example, nesting, mixins, functions or inheritance.
@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);
}
nav {
ul {
margin: 0;
padding: 0;
}
li { display: inline-block; }
a {
display: block;
padding: 6px 12px;
}
}
Vendor prefixes allow us to use newer features not yet considered stable. This approach is falling out of favor though.
Automated visual regression testing using screenshots allows teams to replace manual testing of UI components and pages. It ensures consistency of the UI.