I want to add a very basic less file to my project on github (see this commit).
body {
background-color: red;
}
{
test: /\.less$/,
loaders: ['style', 'css', 'less']
}
webpack --config webpack.config.js -d
<link rel="stylesheet" href="css/bundle.less" />
I expected the deployment folder to now contain bundle.css which contains the contents of my less file. This did not happen.
How do I setup webpack to compile my less?
A couple of things needed to be corrected:
Add require('./myPath/myFile.less')
to your app.js
(or entry point).
The less file does not go in the index.html file.
You need a few dependencies. The versions I used are:
"less": "^2.7.1",
"less-loader": "^2.2.3",
"style-loader": "^0.13.1",
"css-loader": "^0.23.1",
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With