@nodejs-loaders/css-module
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Nodejs Loaders: CSS Module

@node.js loaders logo

npm version unpacked size

Environment: test

Compatible APIs: module.register

This loads the module as a plain-object of simple key-value pairs of the css specifiers like:

/* main.module.css */
#Bar {
  font-weight: bold;
}

.Foo {
  text-decoration: none

  .Baz { color: red }
}

.Qux .Zed {
  font-size: 1.1em;
}
import styles from 'main.module.css';

styles.Bar; // 'Bar'
styles.Baz; // 'Baz'
styles.Foo; // 'Foo'
styles.Zed; // 'Zed'

This ensures snapshots are unaffected by unrelated changes.

[!WARNING] This loader does not differentiate classes vs ids; thus duplicate names can create a last-wins conflict. For example #Foo and .Foo will result in just Foo: 'Foo'. This is unlikely to cause any real-world problems (and you probably shouldn't be doing this anyway).

Package Sidebar

Install

npm i @nodejs-loaders/css-module

Weekly Downloads

21

Version

1.1.0

License

ISC

Unpacked Size

5.41 kB

Total Files

8

Last publish

Collaborators

  • jakobjingleheimer
  • augustinmauroy