Home Ask Login Register

Developers Planet

Your answer is one click away!

aspirisen February 2016

Webpack: How to compile all less files in a project

I use webpack for JS and now I want to use it for styles. I have a lot of styles in different folders and i want to compile them all without requiring each of them mannaully. The question is how to gather all the .less files in the folders and compile them via less-loader?

Answers


Brendan Gannon February 2016

This isn't how webpack is meant to work, really. If you really want to do this, grunt/gulp is going to be a better choice.

Webpack's require mechanism ensures you build only the CSS you need for any given entry point, and gives you dependency management as well. If you do want to use webpack, but don't want to use the style-loader to insert them into the DOM etc., you can use the Extract Text plugin to build your compiled CSS into a separate file.

Post Status

Asked in February 2016
Viewed 2,318 times
Voted 12
Answered 1 times

Search




Leave an answer


Quote of the day: live life