Amazee Labs webinars allow us to share our knowledge and experience with the community. Last week we discussed the challenges in choosing the right CSS-in-JS solution and the advantages of using CSS modules.
Philipp Schmid
Tue, 04/02/2019 – 21:38
After a couple of years of building decoupled sites, the Amazee Labs team has tried several different CSS-in-JS solutions and found this one to be best suited to the needs of our development team.
CSS Modules is a mature project with a syntax that is a superset of CSS, similar to Sass. It makes it easy for you to “think in components” without having to worry about BEM class naming. It automatically generates locally-scoped CSS class names, so you can use “.wrapper” in multiple files without conflict.
It also allows integration of “global” class names from other code (like JS libraries or 3rd party CSS). With CSS Modules you get automatic dead-code elimination as only the CSS used on the page is ever sent to the browsers. Best of all CSS Modules can be used with any JavaScript framework, including React, Angular and Vue.js.
Watch the webinar recording online to learn about:
Components without BEM
Locally-scoped class names
Dead-code elimination
Multi-platform support
Nested rulesets
Cross-component composition
Sharing variables between your JavaScript and your CSS
Catch up on our previous webinars here:
Sharing knowledge and learnings is a key value at Amazee Labs. Keep an eye out for future webinars here!