Last active
November 6, 2020 14:22
-
-
Save billyct/87ced17af0c3e7c0036de5b155ce6f41 to your computer and use it in GitHub Desktop.
laravel-mix customizable antd theme.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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