1
0
Fork 1
mirror of https://example.com synced 2024-11-27 17:46:39 +09:00
firefish/webpack/module/rules/theme-color.ts
2018-02-10 14:56:33 +09:00

25 lines
508 B
TypeScript

/**
* Theme color provider
*/
const StringReplacePlugin = require('string-replace-webpack-plugin');
const constants = require('../../../src/const.json');
export default () => ({
enforce: 'pre',
test: /\.vue$/,
exclude: /node_modules/,
loader: StringReplacePlugin.replace({
replacements: [
{
pattern: /\$theme\-color\-foreground/g,
replacement: () => constants.themeColorForeground
},
{
pattern: /\$theme\-color/g,
replacement: () => constants.themeColor
},
]
})
});