Inject less variables to your less file. Support HMR.
$ npm i webpack-less-theme-plugin --save-dev
Add to webpack config.
// webpack.config.js
const LessThemePlugin = require('webpack-less-theme-plugin');
module.exports = {
...,
plugins: [
new LessThemePlugin({ theme: './blue.less' }),
],
};
// blue.less
@primary-color: blue;
test
- webpack's Condation.rule. Default is/\.less$/
.theme
- less theme file.cwd
- Current working dir.
MIT