strongloop / gulp-loopback-sdk-angular

gulp plugin for auto-generating Angular $resource services for LoopBack
MIT License
27 stars 15 forks source link

Doesn't work with gulp.watch() out of the box #10

Closed faridnsh closed 4 years ago

faridnsh commented 8 years ago

Here's what I tried:

gulp.task('build:lbServices', function() {
    return gulp.src(sources.server)
      .pipe(loopbackAngular())
      .pipe(rename('lb-services.js'))
      .pipe(gulp.dest('./client/js/services'));
});

gulp.task('dev', ['build'], function() {

  // watch for js changes
  gulp.watch(sources.serverJs, ['build:lbServices']).on('change', function(event) {
    // Thought this will solve it, but it didn't
    delete require.cache[event.path];
    delete require.cache[path.resolve(sources.server)];
  });
});

One way to fix this, is to just use the lb-ng command instead(or spawn another process to do this), which will also solve #3 and #9.

0candy commented 8 years ago

Would you like to submit a patch?

faridnsh commented 8 years ago

Another possible solution would be drex. I haven't tried it, but possibly if I find time and at the same being annoyed of this, I'll give it a try and maybe submit a patch.

dhmlau commented 4 years ago

Closing due to inactivity.