The webpack loader for better replace less variables
npm install less-modify-var-loader





> The webpack loader for better replace less variables.
We could use modifyVars option in less-loader for overriding less variables, but it is not friendly for developer (hot updating).
- vars.less
``less`
@width: 100px;
@height: 100px;
@color: blue;
- style.less
`less
@import (reference) './vars.less';
body {
width: @width;
height: @height;
color: @color;
}
`
- _replace.less
`less`
@color: red;
- Output
``
body {
width: 100px;
height: 100px;
color: red;
}
`bash`
npm install less-modify-var-loader -Dor use yarn
yarn add less-modify-var-loader --dev
`javascript`
// ...
module: {
rules: [
{
test: /\.less$/,
use: [
'style-loader',
'css-loader',
{
loader: 'less-loader'
},
{
loader: 'less-modify-var-loader'
}
]
}
]
}
#### filePath
The path of overriding less file, it could be inferred as the closest file from less file, or assigning special file path by absolute path.
- Type: string_replace.less
- Default:
- Fork it!
- Create your new branch:
git checkout -b feature-new or git checkout -b fix-which-buggit commit -am 'feat: some description (close #123)'
- Start your magic work now
- Make sure npm test passes
- Commit your changes:
or git commit -am 'fix: some description (fix #123)'git push`
- Push to the branch:
- Submit a pull request :)
This library is written and maintained by imcuttle, moyuyc95@gmail.com.
MIT - imcuttle 🐟