Answer the question
In order to leave comments, you need to log in
How to connect less to webpack?
Tell me how to generate css from less using webpack. I use Extract Text Plugin.
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const extractLess = new ExtractTextPlugin('public/stylesheets/style.css');
module.exports = {
entry: './public/javascripts/index.js',
output: {
filename: 'bundle.js'
},
module: {
loaders: [{
test: /\.less$/i,
loader: extractLess.extract(['css-loader', 'less-loader'])
}]
},
plugins: [
extractLess
]
};
Answer the question
In order to leave comments, you need to log in
You first need to determine the current language. To do this, at the top of the file, insert
Next, what you need to be displayed depending on the current language:
$my_lang = pll_current_language();
if ( $my_lang == 'en' ) {
echo 'тут какой то контент';
} else {
echo 'тут какой то контент';
}
?>
Webpack 2/3 ?
...
const ExtractTextPlugin = require('extract-text-webpack-plugin');
...
// в секции plugins
plugins: [
...
new ExtractTextPlugin({
filename: 'style-[contenthash].css',
disable: false,
allChunks: false, // true
}),
...
]
в секции module -> rules (loaders)
...
{
test: /\.less$/,
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader: ['css-loader', 'less-loader'],
publicPath: '/public', // ваш publicPath
}),
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question