Skip to content

Instantly share code, notes, and snippets.

@billyct
Last active November 6, 2020 14:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billyct/87ced17af0c3e7c0036de5b155ce6f41 to your computer and use it in GitHub Desktop.
Save billyct/87ced17af0c3e7c0036de5b155ce6f41 to your computer and use it in GitHub Desktop.
laravel-mix customizable antd theme.
let mix = require('laravel-mix');
const antdRegex = /antd.+\.less$/;
const theme = {
'primary-color': '#0097FF',
};
// Exclude quill icons
Mix.listen('configReady', function(config) {
const rules = config.module.rules;
const targetRe = /\.less$/;
for (let rule of rules) {
if (rule.test.toString() == targetRe.toString()) {
rule.exclude = antdRegex;
break;
}
}
});
mix.webpackConfig({
module: {
rules: [{
test: antdRegex,
loader: [
'style-loader',
'css-loader',
{
loader: 'less-loader',
options: {
modifyVars: theme,
}
}
],
}]
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment