less-loader

How to replace the deprecated javascriptEnabled option in less-loader with a new plugin

你离开我真会死。 提交于 2019-12-24 22:04:20
问题 I need to use inline js for my less files, and previously had a webpack config with something like this to enable inline js: module.exports = { ... module: { ... rules: [ ... { test: /\.less$/, use: [ { loader: 'style-loader' }, { loader: 'css-loader' }, { loader: 'less-loader', options: { javascriptEnabled: true }, }, ], }, ], }, }; However the javascriptEnabled option has been deprecated and the replacement for this is to use the @plugin syntax and use a js plugin. However, I am a bit

Webpack: How to merge css and less, THEN apply cssnano

喜你入骨 提交于 2019-12-13 03:41:56
问题 I managed to compile my css and less resources („imported“ from javascript) to all-my-LESS|CSS , extract them using ExtractTextPlugin and merge them together with MergeFilesPlugin to combinedStyles.css . The bit I am missing: How to run cssnano (e.g. through postcss?) on top of that as the finishing bit? (Oh, and while I habe inline source maps, I didn't manage to generate an external combinedStyles.map file). This is my combined webpack.config.babel.js (ignore the babel bit, just means, you

Webpack Less-Loader with Style-Loader not injecting <style> tag

霸气de小男生 提交于 2019-12-11 14:33:57
问题 I'm trying to have our .less files picked up by less-loader , then by css-loader , and finally injected into the HTML file by style-loader , as per the Less Loader docs. I am not getting any errors or warnings, but the styles are not injected or present in any way. My webpack config is as follows, under module.rules[]...: { test: /\.css$/, use: ['style-loader', 'css-loader'] }, { test: /\.less$/, use: [{ loader: "style-loader" // creates style nodes from JS strings }, { loader: "css-loader" /