diff --git a/src/utils/themeUtil.js b/src/utils/themeUtil.js index a08aa06..b3b2f3d 100644 --- a/src/utils/themeUtil.js +++ b/src/utils/themeUtil.js @@ -18,7 +18,9 @@ module.exports = { changeThemeColor (newColor) { let lastColor = this.lastColor || this.primaryColor let options = { - cssUrl: '/css/theme-colors.css', + changeUrl (cssUrl) { + return `/${cssUrl}` // while router is not `hash` mode, it needs absolute path + }, oldColors: this.getThemeColors(lastColor), newColors: this.getThemeColors(newColor) } diff --git a/vue.config.js b/vue.config.js index 14691e2..4d1c9c8 100644 --- a/vue.config.js +++ b/vue.config.js @@ -14,7 +14,7 @@ module.exports = { config.entry.app = ["babel-polyfill", "whatwg-fetch", "./src/main.js"]; config.plugins.push( new ThemeColorReplacer({ - fileName: 'css/theme-colors.css', + fileName: 'css/theme-colors-[contenthash:8].css', matchColors: getThemeColors(themeColor), changeSelector })