Gulp -order: not properly ordered

Gulp is new here, I uploaded gulp-order to order js files for instantiation *. js because some of my javascript files require jquery to load.

Below are my gulpfile.js which have order, concat, rename and uglify.

var date = new Date(); var uniq = date.getTime(); gulp.task('admin-scripts', function() { return gulp.src(['assets/admin/js/*.js','!assets/admin/js/respond.min.js','!assets/admin/js/html5shiv.js']) .pipe(order([ "assets/admin/js/jquery.min.js", 'assets/admin/js/*.js' ])) .pipe(concat(uniq+'admin.js')) .pipe(gulp.dest('build/assets/admin/js/')) .pipe(rename(uniq+'admin.min.js')) .pipe(uglify()) .pipe(gulp.dest('build/assets/admin/js/')); }); 

But the order does not seem to work.

the order is based on the alphabet a.js> z.js instead of jquery.min.js> a.js> z.js

Is there anything that I would write incorrectly on gulpfile.js?

+6
source share
2 answers

The problem of my gulp -order is not ordering correctly / does not work, because I put the wrong path, the path should be relative to the js folder:

correct order: jquery.min.js

wrong order: assets /admin/js/jquery.min.js

 var date = new Date(); var uniq = date.getTime(); gulp.task('admin-scripts', function() { return gulp.src(['assets/admin/js/*.js','!assets/admin/js/respond.min.js','!assets/admin/js/html5shiv.js']) .pipe(order([ "jquery.min.js", '*.js' ])) .pipe(concat(uniq+'admin.js')) .pipe(gulp.dest('build/assets/admin/js/')) .pipe(rename(uniq+'admin.min.js')) .pipe(uglify()) .pipe(gulp.dest('build/assets/admin/js/')); }); 
+4
source

adding a base option fixed this for me:

 .pipe(order([ 'public/js/jquery-1.11.1.min.js', 'public/js/bootstrap.min.js' ], { base: './' })) 
+8
source

All Articles