Skip to content

kingller/css-variables-to-less-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

css-variables-to-less-loader

A loader for webpack. Compiles CSS variables to less variables for support IE.

Install

npm install css-variables-to-less-loader

Usage

Add the loader to your webpack config. For example:

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.less$/i,
        use: [
          // compiles Less to CSS
          "style-loader",
          "css-loader",
          "less-loader",
          {
            loader: 'css-variables-to-less-loader',
            options: {
                // the file include the less variables you want to replace the CSS variables
                // for example, replace var(--primary) with @primary for all less files, if the file contains @primary variable
                varFile: path.join(__dirname, 'src/css/color-variables.less'),
            },
          },
        ],
      },
    ],
  },
};

About

A loader for webpack. Compiles CSS variables to less variables for support IE.

Resources

License

Stars

Watchers

Forks

Packages

No packages published