我正在处理我的Gulp教程(使用此网站:http://www.davepaquette.com/archive/2014/10/08/how-to-use-gulp-in-visual-studio.aspx)。
这是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.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:
以下是任务运行器资源管理器在上面的教程网站中的外观:
我知道为什么我在任务运行器资源管理器中看不到subTasks?
答案 0 :(得分:0)
到目前为止,这是唯一可以解决此问题的方法。
添加任务后,将gulpfile重命名为其他内容,然后关闭Task Runner Explorer。
将重命名的文件更改回gulpfile.js,然后重新打开Task Runner Explorer。
您应该看到您的gulpfile任务已更新。