color: @myColor; Curren" /> color: @myColor; Curren" /> color: @myColor; Curren"/>

use less in html inline style

115 views Asked by At

Is it possible to setup webpack, that I could use less in my html templates like:

// xy.html
<style type="text/less">
    color: @myColor;
</style>

Currently the css/less part of my webpack config looks like:

{
    test: /\.css$/i,
    loader: ['css-loader?esModule=false', 'less-loader'],
    issuer: /\.html?$/i
},
{
    test: /\.css$/i,
    loader: ['style-loader', 'css-loader'],
    issuer: /\.[tj]s$/i
},
{
    test: /\.less$/i,
    loader: ['css-loader?esModule=false', 'less-loader'],
    issuer: /\.html?$/i
},
{
    test: /\.less$/i,
    loader: ['style-loader', 'css-loader', 'less-loader'],
    issuer: /\.[tj]s$/i
},
{
    test: /\.html$/,
    use: [{
        loader: 'html-loader',
        options: {
            minimize: true
        }
    }]
},

Currently I am still using Webpack 4, as one of my dependencies does not yet support Webpack 5.

Thanks a lot for any help!

0

There are 0 answers