diff --git a/packages/@vuepress/core/lib/internal-plugins/palette/index.js b/packages/@vuepress/core/lib/internal-plugins/palette/index.js index ca312481a2..fc0c2684b7 100644 --- a/packages/@vuepress/core/lib/internal-plugins/palette/index.js +++ b/packages/@vuepress/core/lib/internal-plugins/palette/index.js @@ -22,14 +22,13 @@ module.exports = (options, ctx) => ({ const themePalette = path.resolve(ctx.themePath, 'styles/palette.styl') const userPalette = path.resolve(sourceDir, '.vuepress/styles/palette.styl') - .replace(/[\\]+/g, '/') const themePaletteContent = fs.existsSync(themePalette) - ? `@import(${JSON.stringify(themePalette)})` + ? `@import(${JSON.stringify(themePalette.replace(/[\\]+/g, '/'))})` : '' const userPaletteContent = fs.existsSync(userPalette) - ? `@import(${JSON.stringify(userPalette)})` + ? `@import(${JSON.stringify(userPalette.replace(/[\\]+/g, '/'))})` : '' // user's palette can override theme's palette. @@ -38,7 +37,7 @@ module.exports = (options, ctx) => ({ if (ctx.parentThemePath) { const parentThemePalette = path.resolve(ctx.parentThemePath, 'styles/palette.styl') const parentThemePaletteContent = fs.existsSync(parentThemePalette) - ? `@import(${JSON.stringify(parentThemePalette)})` + ? `@import(${JSON.stringify(parentThemePalette.replace(/[\\]+/g, '/'))})` : '' paletteContent = parentThemePaletteContent + paletteContent } diff --git a/packages/@vuepress/core/lib/internal-plugins/style/index.js b/packages/@vuepress/core/lib/internal-plugins/style/index.js index e1754e8bbe..a0646d7d9c 100644 --- a/packages/@vuepress/core/lib/internal-plugins/style/index.js +++ b/packages/@vuepress/core/lib/internal-plugins/style/index.js @@ -17,14 +17,13 @@ module.exports = (options, ctx) => ({ const themeStyle = path.resolve(ctx.themePath, 'styles/index.styl') const userStyle = path.resolve(sourceDir, '.vuepress/styles/index.styl') - .replace(/[\\]+/g, '/') const themeStyleContent = fs.existsSync(themeStyle) - ? `@import(${JSON.stringify(themeStyle)})` + ? `@import(${JSON.stringify(themeStyle.replace(/[\\]+/g, '/'))})` : '' const userStyleContent = fs.existsSync(userStyle) - ? `@import(${JSON.stringify(userStyle)})` + ? `@import(${JSON.stringify(userStyle.replace(/[\\]+/g, '/'))})` : '' let styleContent = themeStyleContent + userStyleContent @@ -32,7 +31,7 @@ module.exports = (options, ctx) => ({ if (ctx.parentThemePath) { const parentThemeStyle = path.resolve(ctx.parentThemePath, 'styles/index.styl') const parentThemeStyleContent = fs.existsSync(parentThemeStyle) - ? `@import(${JSON.stringify(parentThemeStyle)})` + ? `@import(${JSON.stringify(parentThemeStyle.replace(/[\\]+/g, '/'))})` : '' styleContent = parentThemeStyleContent + styleContent }