Skip to content

Commit 592918a

Browse files
meteorlxyulivz
authored andcommitted
fix($core): style and platte path sep on windows (#1246)
1 parent 49c5983 commit 592918a

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

packages/@vuepress/core/lib/internal-plugins/palette/index.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@ module.exports = (options, ctx) => ({
2222

2323
const themePalette = path.resolve(ctx.themePath, 'styles/palette.styl')
2424
const userPalette = path.resolve(sourceDir, '.vuepress/styles/palette.styl')
25-
.replace(/[\\]+/g, '/')
2625

2726
const themePaletteContent = fs.existsSync(themePalette)
28-
? `@import(${JSON.stringify(themePalette)})`
27+
? `@import(${JSON.stringify(themePalette.replace(/[\\]+/g, '/'))})`
2928
: ''
3029

3130
const userPaletteContent = fs.existsSync(userPalette)
32-
? `@import(${JSON.stringify(userPalette)})`
31+
? `@import(${JSON.stringify(userPalette.replace(/[\\]+/g, '/'))})`
3332
: ''
3433

3534
// user's palette can override theme's palette.
@@ -38,7 +37,7 @@ module.exports = (options, ctx) => ({
3837
if (ctx.parentThemePath) {
3938
const parentThemePalette = path.resolve(ctx.parentThemePath, 'styles/palette.styl')
4039
const parentThemePaletteContent = fs.existsSync(parentThemePalette)
41-
? `@import(${JSON.stringify(parentThemePalette)})`
40+
? `@import(${JSON.stringify(parentThemePalette.replace(/[\\]+/g, '/'))})`
4241
: ''
4342
paletteContent = parentThemePaletteContent + paletteContent
4443
}

packages/@vuepress/core/lib/internal-plugins/style/index.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,21 @@ module.exports = (options, ctx) => ({
1717

1818
const themeStyle = path.resolve(ctx.themePath, 'styles/index.styl')
1919
const userStyle = path.resolve(sourceDir, '.vuepress/styles/index.styl')
20-
.replace(/[\\]+/g, '/')
2120

2221
const themeStyleContent = fs.existsSync(themeStyle)
23-
? `@import(${JSON.stringify(themeStyle)})`
22+
? `@import(${JSON.stringify(themeStyle.replace(/[\\]+/g, '/'))})`
2423
: ''
2524

2625
const userStyleContent = fs.existsSync(userStyle)
27-
? `@import(${JSON.stringify(userStyle)})`
26+
? `@import(${JSON.stringify(userStyle.replace(/[\\]+/g, '/'))})`
2827
: ''
2928

3029
let styleContent = themeStyleContent + userStyleContent
3130

3231
if (ctx.parentThemePath) {
3332
const parentThemeStyle = path.resolve(ctx.parentThemePath, 'styles/index.styl')
3433
const parentThemeStyleContent = fs.existsSync(parentThemeStyle)
35-
? `@import(${JSON.stringify(parentThemeStyle)})`
34+
? `@import(${JSON.stringify(parentThemeStyle.replace(/[\\]+/g, '/'))})`
3635
: ''
3736
styleContent = parentThemeStyleContent + styleContent
3837
}

0 commit comments

Comments
 (0)