P
P
Pavel Shorokhov2015-11-17 10:52:54
gulp.js
Pavel Shorokhov, 2015-11-17 10:52:54

Why doesn't gulp merge bower lists in order?

I have bower.json with dependencies:

"dependencies": {
    "jquery": "~2.1.4",
    "jquery.cookie": "~1.4.1",
    "bootstrap": "~3.3.5",
    ...

The main thing here is that bootstrap needs jquery and jquery should be loaded first.
I create a task with Gulp to minify and merge all these files, hoping that order(vendors) will order the files according to the list in bower.json:
var vendors = mainBowerFiles();
gulp.src(vendors)
    .pipe(filter('**.js'))
    .pipe(order(vendors))
    .pipe(uglify())
    .pipe(concat('bower.min.js'))
    .pipe(gulp.dest('static/'));

But at the output, I get a file in which bootstrap is glued second in a row, and jquery is already 4.
Why doesn't order (vendors)) cut jquery to the first line? How can I make this sorting work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arthur Gurinovich, 2015-11-17
@ArthurGurinovich

Might be worth breaking it down into separate tasks:
The order can be written instead of the entire "vendors" folder in this way:
return gulp.src(['./lib/file3.js', './lib/file1.js', './lib/file2.js'])
I did exactly that.
Plugin: gulp-concat

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question