Answer the question
In order to leave comments, you need to log in
How to exclude a folder from a Gulp build?
Good evening.
I need help on how to exclude the less folder from the build task, which collects it in the build folder. I tried by deleting the folder after the build, but it does not delete
var gulp = require("gulp"),
minify = require("gulp-clean-css"),
inlineFonts = require('gulp-inline-fonts'),
lessImport = require('gulp-less-import'),
less = require("gulp-less"),
concat = require("gulp-concat"),
clean = require('gulp-clean');
gulp.task("minify-less", function () {
return gulp.src("./src/less/project/**/*.less")
.pipe(lessImport("./src/less/project/**/*.less"))
.pipe(less())
.pipe(concat("project.min.css"))
.pipe(minify())
.pipe(gulp.dest("./build"));
});
gulp.task("build", ["minify-less"], function () {
return gulp.src(['!./src/less/**/*', './src/**/*', './src/*.html'])
.pipe(gulp.dest('./build'))
return del('./build/less', {force:true});
});
Answer the question
In order to leave comments, you need to log in
Replace the line in the build task :
on the:
-------------------------------------------------- -------------------------------------------------- ----------------------------------------
Here it is:
doesn't work because you have there is already a return statement before this, here:
Remove it, leave it simple:
Or make a separate del task that will remove unnecessary folders after build and run it after the build task .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question