css-module-typescript-loader
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

CSS Module Typescript Loader

GitHub license codecov npm version Known Vulnerabilities Dependency count npm bundle size nodejs version Github CI GitHub Workflow Status Type definitions Website CodeFactor Package Quality GitHub stars

Webpack loader to create TypeScript declarations for CSS Modules.

Emits TypeScript declaration files matching your CSS Modules in the same location as your source files, e.g. src/style.css will generate src/style.css.d.ts.

Why?

There are currently a lot of solutions to this problem. However, this package differs in the following ways:

  • Encourages generated TypeScript declarations to be checked into source control, which allows webpack and tsc commands to be run in parallel in CI.

  • Ensures committed TypeScript declarations are in sync with the code that generated.

Install

npm i -D css-module-typescript-loader

Usage

Place css-module-typescript-loader directly after css-loader in your webpack config.

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/u,
        use: [
          // Here can be `style-loader` or `mini-css-extract-plugin` loader before `css-module-typescript-loader`
          'css-module-typescript-loader',
          {
            loader: 'css-loader',
            options: {
              modules: true
            }
          }
        ]
      }
    ]
  }
};

License

See license.

Package Sidebar

Install

npm i css-module-typescript-loader

Weekly Downloads

14

Version

0.0.4

License

MIT

Unpacked Size

21.6 kB

Total Files

12

Last publish

Collaborators

  • webbestmaster