File.prototype.addCssModule()

Import a CSS module.

Syntax

file.addCssModule(cssFile File)

Parameters

cssFile File

Load CSS module from given file.

Description

Import a CSS module (namespaced stylesheet) and link it to the file’s head string attribute. Returns an object mapping the original CSS class names to their namespaced counterparts. This allows one to guarantee non-conflicting class names across CSS modules.

See the CSS module spec at https://github.com/css-modules/css-modules - but note that :global, :local, and composes are not implemented.

Examples

Typical usage.

Same typical usage, but turned into a deterministic test case.