On a Gulp task to merge JS files I have the following which is working:
var root = "/app/scripts/"
gulp.task("build:scripts", function () {
return gulp.src(
[
root + "jquery.js",
root + "angular.js",
root + "app.js",
root + "app.config.js",
root + "*/*.service.js",
root + "*/*.controller.js"
])
.pipe(concat("app.js"))
.pipe(gulp.dest(paths.scripts.dist))
.pipe(rename("app.min.js"))
.pipe(uglify())
.pipe(gulp.dest(paths.scripts.dist));
});
But I need to first select the files in shared folder and then the others:
var root = "/app/scripts/"
gulp.task("build:scripts", function () {
return gulp.src(
[
root + "jquery.js",
root + "angular.js",
root + "app.js",
root + "app.config.js",
root + "shared/*.service.js",
root + "shared/*.controller.js"
root + "!shared/*.service.js",
root + "!shared/*.controller.js"
])
.pipe(concat("app.js"))
.pipe(gulp.dest(paths.scripts.dist))
.pipe(rename("app.min.js"))
.pipe(uglify())
.pipe(gulp.dest(paths.scripts.dist));
});
But this is not selecting the files that are not in shared folder.
Why is !shared not working? Should not this work?
UPDATE
I also tried
"!" + root + "shared/*.service.js",
and
root + "[^shared]*/*.service.js",
But none of them worked.