@barusu-react/rollup-plugin-postcss-dtsdeprecated

generate *.d.ts for *.styl|*.scss|*.sass|*.css files

Usage no npm install needed!

<script type="module">
  import barusuReactRollupPluginPostcssDts from 'https://cdn.skypack.dev/@barusu-react/rollup-plugin-postcss-dts';
</script>

README

npm version npm download npm license

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: (two spaces)
    • semicolon: {boolean}: whether to add a semicolon at the end of the statement

      • Default: false
    • encoding: {string}: encoding of the target '.d.ts' file

      • Default: utf-8
    • alsoCreateTargetCssDts: {boolean}: whether to aslo create a '*.d.s' file for the output CSS files

      • Default: false
    • 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