目前我正在使用less-loader以及modifyVars覆盖一些较少的变量以自定义样式.
在我的webpack.config.js中
import theme from './theme.js';
{
test: /\.(css|less)$/,
loaders: ['style', 'css?sourceMap', 'postcss', `less-loader?{"sourceMap":true,"modifyVars":${JSON.stringify(theme)}}`],
},
Run Code Online (Sandbox Code Playgroud)
但是对于theme.js中的每一个更改我都必须重新启动服务器,(执行npm运行)有没有办法让它自动就像我更改一个较少的文件并立即更换?
theme.js
module.exports = {
'@primary-color': '#1DA57A',
'@font-size-base': '14px',
'@btn-font-weight': '200',
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
690 次 |
| 最近记录: |