I wrote up some thoughts on the long-term design goals of elm-css. If anyone has feedback on this, I would love to hear it!In particular I'd love to know if I missed something which might change the conclusion. :)
--
You received this message because you are subscribed to the Google Groups "elm-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elm-dev/75c8137b-b5e2-4f3f-8581-eba9a4aefce5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I wrote up some thoughts on the long-term design goals of elm-css. If anyone has feedback on this, I would love to hear it!
Sure, although I'd point them to the #elm-css Slack channel to discuss rather than this list. :)
--
You received this message because you are subscribed to the Google Groups "elm-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elm-dev/7ed9404a-e7e8-4ba8-a651-01e1b5a3484c%40googlegroups.com.
Another factor to consider is that precompiled styles benefit more from gzip. The reason elm-css supports mixin (but not an inheritance feature like @extend from Sass or composes from CSS Modules) is that in practice these inheritance features are worse for both performance and download size (because of gzip) than mixins, making them turn out to be footguns that should never be used for any reason.
.big-text {
font-size: 5em;
}
.big-red-text {
@extend .big-text;
color: red;
}
.big-text, .big-red-text {
font-size: 5em;
}
.big-red-text {
color: red;
}
.bigText {
font-size: 5em;
}
.bigRedText {
composes: bigText;
color: red;
}
.bigText_obfuscated {
font-size: 5em;
}
.bigRedText_obfuscated {
color: red;
}
import styles from './styles.css';
const warning = () =>
<p className={styles.bigRedText}>Warning!</p>
const warning = () =>
<p className={"bigText_obfuscated bigRedText_obfuscated"}>Warning!</p>
My understanding is that CSS Modules' `composes` does not work the same way as Sass’ `extend`
Another benefit to CSS files is that they can be ran through PostCSS which can do a lot of fancy things like add vendor prefixes, inject image dimensions/URLs, etc.
So it would be great if the default is static CSS and also a escape hatch is provided to do run time css when needed by injecting style tags.
I think it's a good practice to encapsulate the styles to a single element.