Toma Marenina
Toma Marenina

Reputation: 1

Gulp-less 4.0.1 and Gulp 4.0.0 don't create output css

I have Gulp 4.0.0, gulp cli 3.9.1 and gulp-less 4.0.0 installed.
I understand that gulp-less 4.0.1 requires gulp 3.x.
The question is "How to use less with gulp 4?"
Console and gulp-util doesn't show any bugs, but it looks like less task is ignored.

Package.json:

{
  "name": "quests",
  "version": "1.0.0",
  "description": "quests",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Toma",
  "license": "ISC",
  "devDependencies": {
    "gulp": "^4.0.0",
    "gulp-less": "^4.0.1"
  }
}

Gulpfile.js:

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

gulp.task('less', function () {
    return gulp.src('less/*.less')
        .pipe(less())
        .pipe(gulp.dest("dist/css"));
});

gulp.task('watch', function(){
    gulp.watch("src/less/*.less").on('change', function(event) {
        console.log(event.path);
        console.log(event.type);
    });
});

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

Console:

[16:53:20] Using gulpfile ~\Documents\quests\gulpfile.js
[16:53:20] Starting 'default'...
[16:53:20] Starting 'less'...
[16:53:21] Finished 'less' after 45 ms
[16:53:21] Starting 'watch'...

Upvotes: 0

Views: 639

Answers (0)

Related Questions