0

I'm using Gulp-imports to combine my library / vendor files into 1 file. https://github.com/ifandelse/gulp-imports

I believe I have it setup correctly, originally I got an error saying gulp.run was deprecated, so I switched to using gulp.watch instead:

gulp.watch('app/assets/js/libs/vendors.min.js', function() {
    console.log('Combining vendor files');
    return gulpImports().pipe(gulp.dest('./min'));
});

It seems to run fine, however the return doesn't complete the process and generate a new vendors.min.js inside of a /min folder.

enter image description here

enter image description here

I run gulp watch and my normal CSS and JS tasks work, and I see the console.log statement for the gulp-imports, but no combined file...


Thanks to the answer below, this is what I used, I did not use gulp.run

gulp.task('imports', function() {
gulp.src(['./app/assets/js/libs/shizz.js'])
    .pipe(gulpImports())
    .pipe(gulp.dest('./result/'));
});

What the shizz.js file looks like:

//import("angular-animate/angular-animate.min.js");
//import("angular-route/angular-route.min.js");
Community
  • 1
  • 1
Leon Gaban
  • 36,509
  • 115
  • 332
  • 529

1 Answers1

1

The example here suggests you're meant to gulp.src some files before piping into gulpImports().

user508633
  • 406
  • 3
  • 13
  • Ah thanks! Yeah I got it to work :) I ended up using `gulp-concat` for my project, but now this works as well too! Will update my question with what I used... – Leon Gaban Feb 20 '16 at 04:58