gulp-file-include
gulp-file-include copied to clipboard
Easier way to skip binary files.
While using gulp-file-include, I think we must set src with !*.{jpg,png,jpeg,gif,bmp,woff,eot,tff...}
to make the process skip compile binary files.
Maybe it will be better if add a param in options just like some others plugins . { skipBinary : true }
Or is there anyway to do this but I didn't find it in documentation ?
Do you use a single gulp task to copy all resources?
If so, the best answer IMHO would be to have gulp tasks with their own src
, pipe
, and dest
pipeline for each major file type. That way you can control which files are sent through gulp-file-include
(and other plugins) and which ones aren't. Then create a default gulp task to do them all (using the dependency parameter). Example:
gulp.task("html", function () {
return gulp.src("*.html")
.pipe(fileInclude({ prefix: "@@", basepath: "./templates/"}))
.pipe(gulp.dest(destFolder));
});
gulp.task("styles", function (callback) {
return gulp.src("*.css").pipe(minifyCSS()).pipe(gulp.dest("output/"));
});
gulp.task("scripts", function (callback) {
return gulp.src("*.css").pipe(uglify()).pipe(gulp.dest("output/"));
});
gulp.task("binary", function() {
return gulp.src("*.{jpg,png,jpeg,gif,bmp...}").pipe(gulp.dest("output/"));
});
gulp.task("default", ["scripts","styles","html","binary"], function (callback) {});