css-module-typescript-loader
v0.0.4
Published
CSS Module TypeScript Loader
Downloads
203
Maintainers
Readme
CSS Module Typescript Loader
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
andtsc
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.