diff --git a/bin/vuepress.js b/bin/vuepress.js index 3f35892921..0514cb46b0 100755 --- a/bin/vuepress.js +++ b/bin/vuepress.js @@ -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)}.`) })