that few years ago, Prototype Javascript library made it an essential part of its architecture. But what hides behind seemingly innocuous practice is a huge load of trouble. […] DOM extension is one of the biggest mistakes Prototype.js has ever done.”
*/ 2 `class=${[styles.normal, styles['primary']].join(" ")}` 3 4 /* Using a single name makes a big difference */ 5 `class=${styles['primary']}` 6 7 /* camelCase makes it even better */ 8 `class=${styles.isPrimary}`
*/ } .normal { composes: common; /* anything that only applies to Normal */ } .disabled { composes: common; /* anything that only applies to Disabled */ }
⚡Fast (a few times faster than Sass) 3. Lots of plugins and easy to write your own 4. Tools like linting or automatic properties sorting 5. IDE Support (WebStorm, Atom, Sublime) 6. Shared constants between CSS and JS 7. Works not only with SPAs or React 8. It’s just CSS*
✅ You plan to update your CSS in the future ✅ You use third-party CSS and don’t want to break things ✅ You care about code readability and reusability ✅ You hate manual work
Runtime re-calculation ✅ Dead code elimination No pseudo-selectors No media queries React.js-only Harder to debug in DevTools No IDE support No tooling