Skip to content
Josh Johnston edited this page Oct 23, 2017 · 1 revision

Principles of CSS Modules

CSS Modules makes it easy to work with CSS classes that are:

  • immutable: once we define a class its meaning should not change (ie. avoid cascading)
  • composeable: compose single-purpose classes together (rather than overriding properties via cascading)
  • meaningful: classes should be small and single-purpose, but not so small that their purpose becomes unclear.

Design Goals

cmz differs from other CSS Modules implementations in the following areas:

  • Faster to install & build.
  • Runs in node & the browser without any additional tools (but we can use a babel plugin to enhance & optimise).
  • Doesn't overload require / import for importing a CSS Module. We can do this with a normal js function call.
  • Doesn't introduce new CSS syntax for composition and values. We can do this in javascript.
Clone this wiki locally