Install
yarn add --dev @barusu-react/rollup-plugin-postcss-dts
Examples
Options
dts
-
boolean
-
true
: use default CSSDtsProps -
false
: don't generate *.d.ts (default)
-
-
CSSDtsProps
-
indent: {string}
:- Default:
- Default:
-
semicolon: {boolean}
: whether to add a semicolon at the end of the statement- Default:
false
- Default:
-
encoding: {string}
: encoding of the target '.d.ts' file- Default:
utf-8
- Default:
-
alsoCreateTargetCssDts: {boolean}
: whether to aslo create a '*.d.s' file for the output CSS files- Default:
false
- Default:
-
hook: {GetCSSTokenHook}
:interface GetCSSTokenHook { /** * get css tokens. * @param cssPath * @param json * @param outputFilePath * @see https://github.com/css-modules/postcss-modules#saving-exported-classes */ getJSON?: ( cssPath: string, json: { [key: string]: string }, outputFilePath: string, ) => Promise<void> | void }
-
shouldGenerateDtsFile
:/** * Determine whether to generate typescript declaration file * for the specified file * * @param cssPath filepath of the css file * @param json css class name map * @param outputFilepath filepath of the ts declaration file */ shouldGenerateDtsFile?: ( cssPath: string, json: { [key: string]: string }, outputFilePath: string, ) => boolean
-
Other Options
References
- rollup-plugin-postcss
-
@barusu-react/rollup-config
- It is recommended to use this build configuration directly.