Я нашел это решение на основе prependData загрузчика sass .
webpack.config.js
const GENERAL_CONFIG_INI = "../config/config.ini";
const THEME_CONFIG_INI = "./config/config.ini";
const path = require('path');
const Promise = require('bluebird');
const fs = Promise.promisifyAll( require('fs') );
const ini = require('ini');
// include the css extraction and minification plugins
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const global_config = ini.parse( fs.readFileSync( GENERAL_CONFIG_INI, 'utf-8' ) );
const theme_config = ini.parse( fs.readFileSync( THEME_CONFIG_INI, 'utf-8' ) );
var a_author_uri = global_config.author_uri.split(":");
var author_protocol = a_author_uri[0];
var author_uri_without_protocol = a_author_uri[1].replace( "//", "" );
var a_author_uri_domain = author_uri_without_protocol.split(".");
var author_uri_domain_name, author_uri_extension;
if( a_author_uri_domain.length === 3 ){
author_uri_domain_name = a_author_uri_domain[1];
author_uri_extension = a_author_uri_domain[2];
}else if( a_author_uri_domain.length === 2 ){
author_uri_domain_name = a_author_uri_domain[0];
author_uri_extension = a_author_uri_domain[1];
}
module.exports = {
entry: './dev/next/style.sass',
output: {
path: path.resolve(__dirname, 'dist/'),
},
module: {
rules: [
// compile all .scss files to plain old css
{
test: /style.sass$/,
use: [ { loader : MiniCssExtractPlugin.loader },
{ loader: 'css-loader' },
{
loader: 'sass-loader',
options: {
prependData: '$theme-name: ' + theme_config.theme_infos.name +
';$author:' + global_config.author +
';$author-uri-protocol:' + author_protocol+
';$author-uri-domain:' + author_uri_domain_name +
';$author-uri-extension:' + author_uri_extension +
';$description:' + theme_config.theme_infos.description.replace(/:/g, "%3A").replace(/;/g, "%3B") + ';',
}
}
]
}
]
},
plugins: [
// extract css into dedicated file
new MiniCssExtractPlugin({
filename: './next/style.css'
})
]
};