布莱恩·麦克基
我想在我的github项目上添加一个非常基本的文件。查看提交
无样式
body{
background-color: red;
}
webpack.config.js
,{
test: /\.less$/,
loaders: ['style', 'css', 'less']
}
命令行构建命令
webpack --config webpack.config.js -d
Index.html
我希望Deployment /文件夹现在包含bundle.css,其中包含我的less文件的内容。这没有发生。
我该如何设置webpack来编译我的更少代码?
布莱恩·麦克基
有几件事需要纠正:
添加require('./myPath/myFile.less')
到您的app.js(或入口点)。less文件不会进入index.html文件。
您需要一些依赖性。我使用的版本是:
“ less”:“ ^ 2.7.1”,
“ less-loader”:“ ^ 2.2.3”,
“ style-loader”:“ ^ 0.13.1”,
“ css-loader”:“ ^ 0.23.1”,
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
编辑于
我来说两句