by clairity · 4y ago · 0 comments
1. nesting - but this is coming!
2. mixins - not even static mixins are coming =(
static mixins might seem to be limited in utility at first, but it'd alleviate a lot of duplicate css by allowing you to have orthogonal groups of styles. so you could have sets of static mixins for borders/shadows, spacing, layout, fonts, etc. that you could mix and match into both element and class styles as you need.
too much nesting can lead to a rat's nest of css (ha), but shallow nesting (1 level mostly, 2 levels on occasion) adds clarity and structure.
what i'm imagining is something more like this very contrived example:
:root {
--thick: 4px;
--border-color: black;
}
$standard-border {
border: 2px solid var(--border-color); /* not evaluated here */
}
div {
@apply $standard-border; /* evaluated here */
}
/* somewhere else, perhaps a different file */
.bordered {
--border-color: grey;
@apply $standard-border; /* evaluated here */
border-width: var(--thick); /* an override */
}
here, the string would simply be substituted into place and then evaluated as if the substitution had been written there all along. this seems like it would avoid the multiple evaluation and circularity issues that have sunken prior proposals.