I
I
Im p3l2017-05-14 23:18:05
gulp.js
Im p3l, 2017-05-14 23:18:05

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

2 answer(s)
E
Edward, 2017-05-15
@LoranDeMarcus

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 .

S
sergey, 2017-05-14
@zorro76

We use the .gitignore file in the project,
for example, its contents:
.sass-cache/
.idea
/node_modules
/bower_components
/builds

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question