Gulp 4默认任务

时间:2018-12-06 09:58:04

标签: gulp-4

我有以下gulpfile.js,我正在通过命令行“ gulp”执行:

 var conf = require('./config.json');
var gulp = require('gulp');
var pug = require('gulp-pug');
//var watch = require('gulp-watch');

function pug(){
    return gulp.src(conf.src.pug + '/*.pug')
        .pipe(pug({
            pretty: true
        }))
        .pipe(gulp.dest(conf.dest.html));
};
function watch(){
    gulp.watch("*.pug", pug);
}
exports.watch = watch;

gulp.task('default',pug);

我收到以下错误消息:

PS C:\intt> gulp
[15:19:35] Using gulpfile C:\intt\gulpfile.js
[15:19:35] Starting 'default'...
[15:19:35] The following tasks did not complete: default
[15:19:35] Did you forget to signal async completion?
PS C:\intt>

1 个答案:

答案 0 :(得分:0)

您必须像下面那样更改代码

exports.pug = pug;

gulp.task('default',pug);

希望这会有所帮助..!