JSPM

  • Created
  • Published
  • Downloads 114918
  • Score
    100M100P100Q163201F
  • License MIT

A require hook to compile CSS Modules on the fly

Package Exports

  • css-modules-require-hook

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (css-modules-require-hook) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

css-modules-require-hook

Automatically compiles a CSS Module to a low-level interchange format called ICSS or Interoperable CSS.

One of the ways you can compile CSS Modules to the ICSS format is through the require hook. The require hook will bind itself to node's require and automatically compile files on the fly. This is similar to Babel's babel/register.

Requirements

To use this tool we require postcss and few plugins to be installed on your project. See the list below:

  • "postcss": "4.x"
  • "postcss-modules-extract-imports": "0.x"
  • "postcss-modules-local-by-default": "0.x"
  • "postcss-modules-scope": "0.x"

Install

$ npm i css-modules-require-hook

Usage

require('css-modules-require-hook');

Specifying options

require('css-modules-require-hook')({
  // Setting this allows you to specify custom PostCSS plugins
  // You may use functions or strings, which match to the modules with the same name
  use: [] // may use `u` for short
});