Creates TypeScript definitions for style files
MIT License
Creates TypeScript definitions for style files using typed-css-modules. Per default creates defintions for .css, .scss and .sass (scss/sass if node-sass is installed).
The goal of the plugin is to generate TypeScript defintions before type checking is done by any other webpack plugin/loader.
If you are using ForkTsCheckerWebpackPlugin you can configure the below in your webpack config:
plugins: [
...
new ForkTsCheckerTypedStylingsWebpackPlugin({
includePaths: ['src']
}),
...
]
This plugin will tap the fork-ts-checker hook forkTsCheckerServiceBeforeStart
and delay type checking until all defintions files have been created.
If you want to run this plugin on, for example, the beforeCompile hook then the below configuration can be used:
plugins: [
...
new TypedStylingsWebpackPlugin({
includePaths: ['src'],
asyncHook: 'beforeCompile'
}),
...
]
string|string[]
:string
string
object[]
SassPreprocessor
and CssPreprocessor
are included. See Preprocessors for more info.object
:boolean
:Example
const fs = require('fs);
class ReadFilePreprocessor {
test(file) {
return true;
}
readSync(file) {
return fs.readFileSync(file);
}
}