0.0.3 • Published 10 months ago

@krutoo/jest-css-modules-transform v0.0.3

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
10 months ago

Jest transformer for css-modules

This package is needed for transform css-modules in Jest.

It supports CSS, Sass and SCSS.

Installation

npm i -D @krutoo/jest-css-modules-transform

Usage

Add transform rule to your Jest configuration:

// jest.config.js
export default {
  transform: {
    // will transform files like "foo.module.css", "foo.m.css", "foo.module.sass"...
    '\\.(module|m)\\.(css|sass|scss)$': '@krutoo/jest-css-modules-transform',
  },
};

Options

You can set options for this transformer:

// jest.config.js
export default {
  transform: {
    '\\.module\\.css$': [
      '@krutoo/jest-css-modules-transform',
      {
        // by default this transformer will emit CJS, but you can force it to emit MJS syntax
        type: 'module',
      },
    ],
  },
};

To Do

  • explore and implement Jest caching of transform results
  • implement ability of selecting sass package (sass or sass-embedded)
0.0.3

10 months ago

0.0.2

1 year ago

0.0.1

1 year ago