creating a less bundle with webpack

2019-08-04 19:02发布

问题:

I need to create a bundle.less file with webpack that behaves the same as less-loader + exctract text plugin EXCEPT that it should not compile less into css, only concatenate all the required less files and inline the less imports.

The reason is that I have some variable that will be resolved at runtime (to allow the user to customize the application theme) but I want to ship in production bundled resources instead of the whole source file collection.

Is there a way to do that with existing plugin or do I need to write a webpack plugin (which I would rather avoid)?

回答1:

In the end I decided to create a custom webpack loader that recursively inline less imports.



标签: webpack less