Hi,

I am trying to write a gulp build process but i am stuck in race condition
due to watch. I don't know how to overcome this problem.

I am trying to watch html/js/ts changes, and using linker to insert script
tags after compiling my code. When linker modifies html file, watch re-runs
the whole build process. Don't know how to solve this.

gulp.task('link',function(){
   gulp.src('./app/index.html')
    .pipe(linker({
        scripts: [ "./app/js/*/**.js ",'!./app/js/browserify/*.js'],
        startTag: '<!--SCRIPTS-->',
        endTag: '<!--SCRIPTS END-->',
        fileTmpl: '<script src="%s"></script>',
        appRoot: './app'
    }))
    .pipe(gulp.dest('./app')).pipe(livereload());})


gulp.task('watch', function() {
    // watch many files
    livereload.listen();
    
gulp.watch(['./app/**/*.html','./app/**/*.ts','./app/js/browserify/*.js']).on('change',function
() {
        return runSequence(['clean'],
            ['cleanbundle'],
            ['compile'],
            ['lint'],
            ['browserify'],
            ['link']);
    });});


Regards,
Wasim

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAHWx-HD7Pbys2zU7sGsQ_%3DCqpHYo5PV1UsA%3DH4QvsF9Tz4rFLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to