constant-locals-loader

0.1.0 • Public • Published

constant-locals-loader for Webpack

This loader optimizes the output of mini-css-extract-plugin and/or css-loader, entirely removing the potentially large CSS classname mappings normally inlined into your bundle when using CSS Modules.

To use it, make the following changes in your Webpack configuration:

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
+         'constant-locals-loader',
          {
            loader: MiniCSSExtractPlugin.loader,
            options: {
+             esModule: true,
            },
          },
          {
            loader: 'css-loader',
            options: {
              modules: true,
+             localsConvention: 'camelCaseOnly',
+             esModule: true,
            },
          },
        ],
      },
    ],
  },
  plugins: [new MiniCSSExtractPlugin({})],
};

Readme

Keywords

none

Package Sidebar

Install

npm i constant-locals-loader

Weekly Downloads

128

Version

0.1.0

License

Apache-2.0

Unpacked Size

2.61 kB

Total Files

3

Last publish

Collaborators

  • developit