Skip to content

Commit 2d811ed

Browse files
committed
fix: remove override import when ejecting (close #56)
1 parent d931750 commit 2d811ed

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bin/vuepress.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,15 @@ program
4242
.command('eject [targetDir]')
4343
.description('copy the default theme into .vuepress/theme for customization.')
4444
.action(async (dir = '.') => {
45-
const { copy } = require('fs-extra')
45+
const fs = require('fs-extra')
4646
const source = path.resolve(__dirname, '../lib/default-theme')
4747
const target = path.resolve(dir, '.vuepress/theme')
48-
await copy(source, target)
48+
await fs.copy(source, target)
49+
// remove the import to default theme override
50+
const styleConfig = path.resolve(target, 'styles/config.styl')
51+
const content = await fs.readFile(styleConfig, 'utf-8')
52+
const transformed = content.split('\n').slice(0, -2).join('\n')
53+
await fs.writeFile(styleConfig, transformed)
4954
console.log(`Copied default theme into ${chalk.cyan(target)}.`)
5055
})
5156

0 commit comments

Comments
 (0)