search

Home  >  Q&A  >  body text

javascript - How to compile less in multiple folders using gulp

The project directory is as shown:

The 2015, 2016, and 2017 folders are at the same level as gulpfile.js, package, and node_module.
I want to automatically compile the less files in each folder and generate them in their respective css folders. Then the code I wrote is as follows:

var gulp = require('gulp'),
    less = require('gulp-less');

//LESS编译任务
gulp.task('less', function () {
    gulp.src('./*/less/*.less')
        .pipe(less())
        .pipe(gulp.dest('./*/css'));
});

gulp.task('default', function () {
    gulp.watch('./*/less/*.less', ['less']);
});

How should I modify it?

滿天的星座滿天的星座2724 days ago666

reply all(2)I'll reply

  • 滿天的星座

    滿天的星座2017-06-12 09:32:02

    gulp.src('./**/less/*.less'), or you can pass an array.

    reply
    0
  • 巴扎黑

    巴扎黑2017-06-12 09:32:02

    You can create a task and then use run-sequence

    reply
    0
  • Cancelreply