node.js - Including concatenated scripts asynchronously with gulp.js -
i'm trying following:
gulp.src('js/*.js') .pipe(concat('_temp.js')) .pipe(gulp.dest('js/')); gulp.src('build/js/app.js') .pipe(replace('// includes', fs.readfilesync('js/_temp.js'))) .pipe(uglify()) .pipe(rename('app.min.js')) .pipe(gulp.dest('build/js'));
so, i'm concatenating .js
files in js/
. concatenated file named _temp.js
;
after that, i'm reading app.js
, try replace // includes
string concatenated _temp.js
file. doesn't work node says file doesn't exist. exist though, second time run task, works.
this has asynchronisity, i'm unable see how differently?
you can split task 2 , make 1 of tasks run after using gulp's dependency resolution system.
gulp.task('task1', function () { ... }); gulp.task('task2', ['task1'], function () { ... });
Comments
Post a Comment