From 2d811ed3e81150f2f09465c2979f19c647e015f2 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 16 Apr 2018 11:50:05 -0400 Subject: [PATCH] fix: remove override import when ejecting (close #56) --- bin/vuepress.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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)}.`) })