Skip to content

Commit

Permalink
fix: remove override import when ejecting (close #56)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 16, 2018
1 parent d931750 commit 2d811ed
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bin/vuepress.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ program
.command('eject [targetDir]')
.description('copy the default theme into .vuepress/theme for customization.')
.action(async (dir = '.') => {
const { copy } = require('fs-extra')
const fs = require('fs-extra')
const source = path.resolve(__dirname, '../lib/default-theme')
const target = path.resolve(dir, '.vuepress/theme')
await copy(source, target)
await fs.copy(source, target)
// remove the import to default theme override
const styleConfig = path.resolve(target, 'styles/config.styl')
const content = await fs.readFile(styleConfig, 'utf-8')
const transformed = content.split('\n').slice(0, -2).join('\n')
await fs.writeFile(styleConfig, transformed)
console.log(`Copied default theme into ${chalk.cyan(target)}.`)
})

Expand Down

0 comments on commit 2d811ed

Please sign in to comment.