【问题标题】:Gulp ignoring dependencyGulp 忽略依赖
【发布时间】:2016-02-18 13:15:27
【问题描述】:

我试图弄清楚为什么我的 gulp 任务没有按照我想要的顺序运行,这里是代码;

gulp.task('styles', ['clean-styles'], function () {
    log('Compiling Less --> CSS');

return gulp
    .src(config.less)
    .pipe($.less())
    .pipe($.autoprefixer({browsers: ['last 2 version', '> 5%']}))
    .pipe(gulp.dest(config.temp));
});

gulp.task('clean-styles', function (done) {
    var files = config.temp + '**/*.css';
    clean(files, done);
});

function clean(path, done) {
    log('Cleaning: ' + $.util.colors.blue(path));
    del(path, done);
}

当我运行 'gulp styles' 时,它只运行 'clean-styles' 函数,而它应该在完成 clean 任务后运行 'styles' 函数。

简而言之,问题是;

为什么我的“样式”任务在执行时会被忽略?

提前致谢

【问题讨论】:

    标签: javascript node.js gulp less gulp-less


    【解决方案1】:

    试试这个:

    //An array of tasks to be executed and completed before your task will run.
    gulp.task('clean-styles', ['styles'], function() {
      // Do stuff
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-06
      • 1970-01-01
      • 2017-12-16
      • 1970-01-01
      • 2018-01-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多