ts-css-modules-webpack-loader

1.2.5 • Public • Published

ts-css-modules-webpack-loader

Build Status npm version

Take the output of css-loader with css modules and creates a typescript definition of them

For a simpler setup and a verify mode look at css-modules-typescript-loader

Install

npm i -D ts-css-modules-webpack-loader

Example

    loaders: [
      {
        loader: require.resolve("style-loader"),
      },
      {
        loader: require.resolve("ts-css-modules-webpack-loader"),
        options: {
          banner: "//This file is automatically generated, please do not change this file!",
          dest: "./definitions",
          root: "./components",
        },
      },
      {
        loader: require.resolve("css-loader"),
        options: {
          modules: {
            localIdentName: "[name]___[local]",
          },
        },
      },
      {
        loader: require.resolve("sass-loader"),
        query: {
          modules: true,
        },
      },
    ],

Options

Options you can provide to the loader, none is required

Option default Usage
banner "" Printed at the top of every definition file
dest this.context Definition folder (will use relative under from root), by default put it next to the css file
root this.rootContext Relative root of the tree (in general src is good)

Package Sidebar

Install

npm i ts-css-modules-webpack-loader

Weekly Downloads

1

Version

1.2.5

License

ISC

Unpacked Size

6.94 kB

Total Files

5

Last publish

Collaborators

  • yvanguidoin