javascript - gulp-insert exclude wrap certain files -
i want use gulp-insert wrapping on every js file, except .module.js
file.
here gulp task:
gulp.task('compressjs', function() { gulp.src("local/app/**/*.js") .pipe(sourcemaps.init()) // wrap each individual js file .pipe(insert.wrap('(function(){"use strict";', '\n})();')) .pipe(uglify()) .pipe(concat('all.min.js')) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('public/app')); }
it wrapping every single js file expected. so, how can exclude wrapping file .module.js
extension?
you try using gulp-add-src
excluding .module.js
first source piping through gulp-insert
, adding .module.js
back source.
var addsrc = require("gulp-add-src"); gulp.task('compressjs', function() { gulp.src(["local/app/**/*.js", "!local/app/**/*.module.js"]) .pipe(sourcemaps.init()) // wrap each individual js file .pipe(insert.wrap('(function(){"use strict";', '\n})();')) // add modules file .pipe(addsrc("local/app/**/*.module.js")) .pipe(uglify()) .pipe(concat('all.min.js')) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('public/app')); }
Comments
Post a Comment