From 2bea54c4fad35f68066b91e7e42e719392ffcf81 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Tue, 10 Apr 2018 13:37:06 +0800 Subject: [PATCH] fix docs --- scripts/gulpfile.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/scripts/gulpfile.js b/scripts/gulpfile.js index 1328ed011..ca558fe9e 100644 --- a/scripts/gulpfile.js +++ b/scripts/gulpfile.js @@ -1,6 +1,6 @@ 'use strict' const webpack = require('webpack') - +const through2 = require('through2') const path = require('path') const gulp = require('gulp') const readline = require('readline') @@ -67,6 +67,26 @@ function copyHtml () { fs.writeFileSync(path.join(cwd, `${toPath2}/index.html`), fs.readFileSync(path.join(cwd, 'site-dist/index.html'))) }) }) + const source = [ + 'docs/vue/*.md', + // '!components/vc-slider/**/*', // exclude vc-slider + ] + gulp.src(source).pipe(through2.obj(function z (file, encoding, next) { + const paths = file.path.split('/') + const name = paths[paths.length - 1].split('.')[0] + const toPaths = [ + 'site-dist/docs', + 'site-dist/docs/vue', + `site-dist/docs/vue/${name}`, + `site-dist/docs/vue/${name}-cn`, + ] + toPaths.forEach(toPath => { + mkdirp(path.join(cwd, toPath), function () { + fs.writeFileSync(path.join(cwd, `${toPath}/index.html`), fs.readFileSync(path.join(cwd, 'site-dist/index.html'))) + }) + }) + next() + })) } gulp.task('site-dist', (done) => {