簡體   English   中英

我可以將gulp任務標記為無法由開發人員運行嗎?

[英]can I mark gulp task as non runnable by the developer?

我有以下任務:

gulp.task('build', [], function () {
        log('Building the optimized app');
        return gulp.src('').pipe(plug.notify({
            onLast: true,
            message: 'Code Deployed!'
        }));
    });

gulp.task('build-debug', function (callback) {
    log('Building the optimized app in debug mode');
    debug = true;
    runSequence('clean', ['build'], callback);
});

您可以使用build看到該build-debug。
我想開發商將能夠運行編譯調試,這意味着建設任務將不會運行的,除非它被從構建調試調用。

它不是完全“不可運行的”,但是除非通過build-debug調用,否則您始終可以使其不做任何事情,並且在這種情況下,您似乎已經設置了一個標志,因此,如果您像這樣更改構建任務,則:

gulp.task('build', [], function () {
    if (!debug) {
        log('The build task cannot be run on its own, use \'build-debug\' instead');

        return;
    }

    log('Building the optimized app');
    return gulp.src('').pipe(plug.notify({
        onLast: true,
        message: 'Code Deployed!'
    }));
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM