Leon Gaban
Leon Gaban

Reputation: 39018

Gulp-imports, did not generate new file

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");

Upvotes: 0

Views: 151

Answers (1)

user508633
user508633

Reputation: 406

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

Upvotes: 1

Related Questions