From ad6374236fb638e9c6e053091270fc844efe31b3 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Fri, 20 Apr 2018 17:07:41 +0800 Subject: [PATCH] add site iframe support --- scripts/gulpfile.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/gulpfile.js b/scripts/gulpfile.js index ca558fe9e..7df1ceb6b 100644 --- a/scripts/gulpfile.js +++ b/scripts/gulpfile.js @@ -56,15 +56,17 @@ function copyHtml () { rl.on('line', (line) => { const name = line.split('antd/')[1].split('/')[0] console.log('create path:', name) - const toPath1 = `site-dist/components/${name}` - const toPath2 = `site-dist/components/${name}-cn` - rimraf.sync(path.join(cwd, toPath1)) - rimraf.sync(path.join(cwd, toPath2)) - mkdirp(path.join(cwd, toPath1), function () { - fs.writeFileSync(path.join(cwd, `${toPath1}/index.html`), fs.readFileSync(path.join(cwd, 'site-dist/index.html'))) - }) - mkdirp(path.join(cwd, toPath2), function () { - fs.writeFileSync(path.join(cwd, `${toPath2}/index.html`), fs.readFileSync(path.join(cwd, 'site-dist/index.html'))) + const toPaths = [ + `site-dist/components/${name}`, + `site-dist/components/${name}-cn`, + `site-dist/iframe/${name}`, + `site-dist/iframe/${name}-cn`, + ] + toPaths.forEach(toPath => { + rimraf.sync(path.join(cwd, toPath)) + mkdirp(path.join(cwd, toPath), function () { + fs.writeFileSync(path.join(cwd, `${toPath}/index.html`), fs.readFileSync(path.join(cwd, 'site-dist/index.html'))) + }) }) }) const source = [