css-esm
CSS modules in the browser, with lightweight preprocessing by stylis.js
Based on the quite awesome csz library by Luke Jackson.
Usage
With inline styles:
; const styles = css` .button { color: red; } :global (.foo) { .button.is-primary { color: green; } }`; documentbodyinnerHTML = ` Get started Another button `;
With external files:
;const styles = ; documentbodyinnerHTML = ` Get started`;
While mapped class names are available immediately, you can see when the CSS file has loaded using
the special $loaded
property (a Promise
):
const styles = ;await styles$loaded;