javascript - Gulp Watch Concat sometimes ignores some JS files -


I have a Falcon Conset Watch task setup to include some JS files:

 < Code> var source = ['public / js / script ajs',' public / js / scriptb.js', 'public / js / script c. JS ',' Public / JS / Script D. JS ',' Public / JS / Script EJs']; Gulp.task ('main.js', function) (return gulp.src (source) .pipe (conat ('main.js')) .pipe (gulp.dest ('. / Public / js'));} ); Gulp.task ('clock', function () {gulp.watch (source, ['main.js']);});  

Pretty simple setup I think whenever a script changes, then main.js is created by adding the script to that sequence. It works 99% of the time right.

But sometimes, perhaps randomly, the connection only leaves 1 or more files. For example, I will edit scriptB.js , save it , Then look at main.js and only copy it to scriptA , code> script b and script A . It completely left C and D out and sometimes it might just be C. Sometimes it can be D. Sometimes this can happen. It's just random I have not done anything to any of those files which leaves it, I have opened it in my editor but it is unchanged and just sat there. Gullup decides to leave it for just a few random reasons.

The way I am fixing it is to open any script that has been left and to save it to a random line or something, then main.js Is included as I expect. There was nothing wrong in the file just saved it.

Is this an excellent bug for someone's knowledge? I have not been able to find any information anywhere on this bug

One thing I did notice says that I was editing scriptC and asked to save it . This, and then the notice scriptD was unavailable. If I go back to scriptC and save it again, then scriptD is not included yet. To open me scriptD and to save it forcefully, it should be included back in main.js . So once I see the problem popup, I can usually rest it like this.

It usually only occurs in 1 out of 20.

You can use the plug-in plugin to get rid of the problem. With this plugin you can include / include your JS files using special comments in the main.js file.

main.js:

  // 'required' public /js/scriptA.js '//' Required 'public / js / scriptb.js' // = 'Public / js / script c. JS '// //' public / js / script d. JS 'is required // requires' public / js / scriptE.js'  

gulpfile.js:

  var gulp = require ( "Gullup"), Include = Requirement ("Gump-Inserted"); Gulp.task ("script", function () {gulp.src ("main.js") .pipe (included ()) .on ('error', console.log) .pipe (gulp.dest ("./ Public / js ");}); Gulp.task ('clock', function () {gulp.watch (source, ['main.js']);});  

The plugin is available via npm:


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -