Skip to content

Commit

Permalink
fix($core): style and platte path sep on windows (#1246)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy authored and ulivz committed Jan 29, 2019
1 parent 49c5983 commit 592918a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions packages/@vuepress/core/lib/internal-plugins/palette/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}
Expand Down
7 changes: 3 additions & 4 deletions packages/@vuepress/core/lib/internal-plugins/style/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,21 @@ 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

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
}
Expand Down

0 comments on commit 592918a

Please sign in to comment.