Gulp 为什么不在任务运行器资源管理器中创建子任务?
我正在编写Gulp教程(使用此网站:) 以下是gulpFile.js:Gulp 为什么不在任务运行器资源管理器中创建子任务?,gulp,Gulp,我正在编写Gulp教程(使用此网站:) 以下是gulpFile.js: // include plug-ins var gulp = require('gulp'); var concat = require('gulp-concat'); var uglify = require('gulp-uglify'); var del = require('del'); var config = { //Include all js files but exclude any min
// include plug-ins
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var del = require('del');
var config = {
//Include all js files but exclude any min.js files
src: ['app/**/*.js', '!app/**/*.min.js']
}
//delete the output file(s)
gulp.task('clean', function () {
//del is an async function and not a gulp plugin (just standard nodejs)
//It returns a promise, so make sure you return that from this task function
// so gulp knows when the delete is complete
return del(['app/all.min.js']);
});
// Combine and minify all files from the app folder
// This tasks depends on the clean task which means gulp will ensure that the
// Clean task is completed before running the scripts task.
gulp.task('scripts', ['clean'], function () {
return gulp.src(config.src)
.pipe(uglify())
.pipe(concat('all.min.js'))
.pipe(gulp.dest('app/'));
});
gulp.task('watch', function () {
return gulp.watch(config.src, ['scripts']);
});
//Set a default tasks
gulp.task('default', ['scripts'], function () { });
以下是任务运行器资源管理器:
下面是task runner explorer在上述教程站点中的外观:
知道为什么我在任务运行器资源管理器中看不到子任务吗?这是迄今为止我唯一能够解决这个问题的方法 添加任务后,将gulpfile重命名为其他文件,然后关闭task Runner Explorer 将重命名的文件更改回gulpfile.js,然后重新打开Task Runner Explorer
您应该看到您的gulpfile任务已更新。此处相同。跑步VS 2015。本教程使用的是较旧版本的VS,因为作者提到必须安装一个Task Runner Explorer插件,该插件已经为VS 2015内置。在这里运行VS 2015 Update 3也是一样的