我的默认 gulp 任务没有执行其他任务

My default gulp task is not executing other tasks

我有一个 gulp 任务,当我一次 运行 任务时它可以工作,但由于某种原因我没有得到,当我 运行 [=14] =] 任务,所有 运行s 都是干净的。有什么想法我错了吗?下面的脚本。

(function () {
        'use strict';

        // Load plugins
        var gulp = require('gulp'),
            uglify = require('gulp-uglify'),
            rename = require('gulp-rename'),
            concat = require('gulp-concat'),
            notify = require('gulp-notify'),
            htmlreplace = require('gulp-html-replace');

        gulp.task('scripts', function () {
            return gulp.src(['public/app/**/*.js','public/app.js'])
                .pipe(concat('main.js'))
                .pipe(gulp.dest('public/dist'))
                .pipe(rename({suffix: '.min'}))
                .pipe(uglify())
                .pipe(gulp.dest('public/dist'))
                .pipe(notify({message: 'Scripts task complete'}));
        });


        gulp.task('copyfiles', function () {
            gulp.src('public/dist/**/*')
                .pipe(gulp.dest('../../ExtJSApps/dash1'))
                .pipe(notify({message: 'copyfiles task complete'}));
        });

        gulp.task('indexhtml', function () {
            gulp.src('public/index.html')
                .pipe(rename('indexnomin.html'))
                .pipe(htmlreplace({
                    'css': '/ExtJSApps/ext-4.2.2.1144/resources/ext-theme-neptuneext-theme-neptune-all-debug.css',
                    'js': ['/ExtJSApps/ext-4.2.2.1144/ext-all-dev.js',
                        'main.js']
                }))
                .pipe(gulp.dest('public/dist/'))
                .pipe(notify({message: 'indexhtml task complete'}));
            //console.log('2x');
        });

        gulp.task('indexhtmlmin', function () {
            gulp.src('public/index.html')
                .pipe(htmlreplace({
                    'css': '/ExtJSApps/ext-4.2.2.1144/resources/ext-theme-neptune/ext-theme-neptune-all.css',
                    'js': [
                        '/ExtJSApps/ext-4.2.2.1144/ext-all.js',
                        'main.min.js'
                    ]
                }))
                .pipe(gulp.dest('public/dist/'))
                .pipe(notify({message: 'indexhtmlmin task complete'}));
        });

        gulp.task('clean', function (cb) {
        });

        // Default task
        gulp.task('default', ['clean'], function () {
            gulp.start('scripts','copyfiles', 'indexhtml', 'indexhtmlmin');
        });
    }());

最后一行括号错误:

}());

应该是

})();

另外你应该知道 gulp.startdeprecated and you should look into gulp-load-plugins and general gulp architecture.

改变

// Default task
gulp.task('default', ['clean'], function () {
    gulp.start('scripts','copyfiles', 'indexhtml', 'indexhtmlmin');
});

gulp.task('default', ['clean', 'scripts', 'copyfiles', 'indexhtml', 'indexhtmlmin']);