Hayatomo Hayatomo - 5 months ago 42
Javascript Question

Task 'sassToCss, jadeToHtml' is not in your gulpfile


Task 'sassToCss, jadeToHtml' is not in your gulpfile


I'm new to gulp. I got this error.

What's wrong with my code?

This code worked until I added the function to watch "jadeToHtml".
I think there is mistake in adding watch operation.

gulpfile.js

var gulp = require("gulp");
var sass = require("gulp-sass");
var postcss = require("gulp-postcss");
var autoprefixer = require("autoprefixer");
var jade = require("gulp-jade");
var plumber = require('gulp-plumber');


gulp.task("sassToCss", function() {

var processors = [
autoprefixer({browsers: ["last 1 version"]})
];
console.log("done2");

return gulp.src("sass/*.sass")
.pipe(plumber())
.pipe(sass())
.on("error", function(error) {
console.log(error.message)
})
.pipe(gulp.dest("./css"));


});


gulp.task("jadeToHtml", function() {

var options = {
pretty: true
};

return gulp.src("jade/*.jade")
.pipe(plumber())
.pipe(jade(options))
.on("error", function(error) {
console.log(error.message)
})
.pipe(gulp.dest("./html"));

});


gulp.task("log", ["sassToCss, jadeToHtml"], function() {
console.log("done");
});

gulp.task("watch", function() {
gulp.watch("sass/*.sass", ["sassToCss"]);
gulp.watch("jade/*.jade", ["jadeToHtml"]);

});

gulp.task("default", ["sassToCss", "jadeToHtml", "log", "watch"]);

Answer

It's a silly mistake:

You are missing quotes in the gulp.task("log"... definition:

gulp.task("log", ["sassToCss, jadeToHtml"], function() {
    console.log("done");
});

Should be:

gulp.task("log", ["sassToCss", "jadeToHtml"], function() {
    console.log("done");
});
Comments