This is an automated email from the ASF dual-hosted git repository. zregvart pushed a commit to branch website in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2ba80c8d9de1f64e8fc08e985b2894d082c1d9b2 Author: Zoran Regvart <zregv...@apache.org> AuthorDate: Mon Jul 3 23:42:35 2017 +0200 CAMEL-11492 New Camel website Improve gulp watch task to take into account only changed files and reuse the pipe from the component tasks. --- camel-website/gulpfile.js | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/camel-website/gulpfile.js b/camel-website/gulpfile.js index 75b7ed5..5b36839 100644 --- a/camel-website/gulpfile.js +++ b/camel-website/gulpfile.js @@ -21,16 +21,23 @@ const replace = require('gulp-replace'); const version = process.env.npm_package_version.replace(/-.*/, ''); -gulp.task('docs', ['component-doc']); - -gulp.task('component-doc', () => { - gulp.src('../components/readme.adoc') - .pipe(replace(/link:.*\/(.*).adoc(\[.*)/g, `link:components/${version}/$1$2`)) - .pipe(rename('components.adoc')) - .pipe(gulp.dest('content')); - gulp.src('../components/**/src/main/docs/*.adoc') - .pipe(rename({dirname: ''})) - .pipe(gulp.dest(`content/components/${version}`)); +gulp.task('docs', ['components-readme', 'components']); + +const components = (path) => gulp.src(path || '../components/**/src/main/docs/*.adoc') + .pipe(rename({dirname: ''})) + .pipe(gulp.dest(`content/components/${version}`)); + +gulp.task('components', () => { + return components(); +}); + +const componentReadme = () => gulp.src('../components/readme.adoc') + .pipe(replace(/link:.*\/(.*).adoc(\[.*)/g, `link:components/${version}/$1$2`)) + .pipe(rename('components.adoc')) + .pipe(gulp.dest('content')); + +gulp.task('components-readme', () => { + return componentReadme(); }); gulp.task('asciidoctor-shim', () => { @@ -43,6 +50,11 @@ gulp.task('asciidoctor-shim', () => { gulp.task('default', ['docs', 'asciidoctor-shim']); gulp.task('watch', () => { - gulp.watch('../**/*.adoc', ['docs']); -}); + gulp.watch(['../components/**/*.adoc', '!../components/readme.adoc'], (event) => { + components(event.path); + }); + gulp.watch('../components/readme.adoc', (event) => { + componentReadme(); + }); +});