I am trying to concatinate my js files with gulp's concate module.
My projects path to js files is: project/public/js/vendor/
.
In vendor are all the plugins I use and I want to concatinate them to a single file
I use the following code to execute my task.
var gulp = require('gulp'),
concat = require('gulp-concat');
gulp.task('scripts',function(){
return gulp.src('./vendor/*.js')
.pipe(concat('global.js'))
.pipe(gulp.dest('concat/'));
});
gulp.task('default', ['scripts']);
I want to export the file to concat folder which is located into /js, but I get no file. The code executes with no error report.
[gulp] Using gulpfile /var/www/vhosts/site.dev/httpdocs/project/gulpfile.js
[gulp] Starting 'scripts'...
[gulp] Finished 'scripts' after 9.2 ms
[gulp] Starting 'default'...
[gulp] Finished 'default' after 8.8 μs
Did I do something wrong?
Edit 1
I tried to log the count as it was suggested and returned:
[gulp] Using gulpfile /var/www/vhosts/site.dev/httpdocs/laravel/gulpfile.js
[gulp] Starting 'scripts'...
[gulp] Finished 'scripts' after 12 ms
[gulp] Starting 'default'...
[gulp] Finished 'default' after 9.37 μs
Does this means that it didn't select any js?
mostly there are not source files being selected, use gulp-count to print the number of files selected
var count = require('gulp-count');
gulp.task('scripts',function(){
return gulp.src('./vendor/*.js')
.pipe(count('## js-files selected'))
.pipe(concat('global.js'))
.pipe(gulp.dest('concat/'));
});
if you get count as 0, given your path is project/public/js/vendor/
change your gulp.src
to gulp.src('project/public/js/vendor/**/*.js')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With