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

  1. change environment in templateconfig, template generated accordingly
  2. compile template using task 1
  3. wait compilation finish, can take long time
  4. generate build dist


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -