How to Pass Data OR communicate Between Two Dependent Gulp tasks? -
i want run task in sequence, want pass data 1 task another.
here code.
gulp task 1 -> compile html
gulp.task('compile:html', function () { return gulp.src(['src/templates/*.html', 'src/templates/*.template']) .pipe(plumber()) .pipe(nunjucksrender({ data: templateconfig, //in templateconfig environment saved path: ['src/templates/'] })) .pipe(gulp.dest('src/')); });
gulp task 2 -> generate build
gulp.task('build:production', function (callback) { var temp = templateconfig.env; templateconfig.env = 'production'; gulp.start('compile:html'); settimeout(function () { //gulp.src('./src/assets/**/*.*').pipe(gulp.dest('./generated/dist/production/assets')); gulp.src('src/*.html') .pipe(userref()) .pipe(gulpif('*.js', uglify())) .pipe(gulpif('*.css', minifycss())) .pipe(gulp.dest('./dist/production')); templateconfig.env = temp; callback(); }, 2500); });
currently using timeout in task 2 give time render templates according environment.
task 2 (generate build) requirements
- change environment in templateconfig, template generated accordingly
- compile template using task 1
- wait compilation finish, can take long time
- generate build dist
Comments
Post a Comment