sharkey/webpack/module/rules/theme-color.ts

26 lines
508 B
TypeScript
Raw Normal View History

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