Less compilation with webpack

I want to add a very simple file to my github project . See commit

style.less

body{ background-color: red; } 

webpack.config.js

 ,{ test: /\.less$/, loaders: ['style', 'css', 'less'] } 

Build command line command

webpack --config webpack.config.js -d

Index.html

I was expecting the deployle folder to now contain the bundle.css file, which contains the contents of my smaller file. That did not happen.

How to configure webpack to compile my lesser?

+5
source share
1 answer

A few things that should have been fixed :

  • Add require('./myPath/myFile.less') to your app.js (or entry point). The fewer files in the index.html file, the smaller.

  • You need some dependencies. Used Versions:

    "less": "^ 2.7.1",
    "less-loader": "^ 2.2.3",
    bootloader style: "^ 0.13.1",
    "css-loader": "^ 0.23.1",

+6
source

All Articles