国产gaysexchina男同gay,japanrcep老熟妇乱子伦视频,吃奶呻吟打开双腿做受动态图,成人色网站,国产av一区二区三区最新精品

gulp.task()

2020-09-30 18:06 更新

gulp.task()介紹

提醒: 這個(gè)API不再是推薦的模式了 - export your tasks。因此就不翻譯了!

在任務(wù)系統(tǒng)中定義任務(wù)。然后可以從命令行和 series()、parallel() 和 lastRun() api 訪問(wèn)該任務(wù)。

Usage

Register a named function as a task:

const { task } = require('gulp');

function build(cb) {
  // body omitted
  cb();
}

task(build);

Register an anonymous function as a task:

const { task } = require('gulp');

task('build', function(cb) {
  // body omitted
  cb();
});

Retrieve a task that has been registered previously:

const { task } = require('gulp');

task('build', function(cb) {
  // body omitted
  cb();
});

const build = task('build');

Signature

task([taskName], taskFunction)

Parameters

If the taskName is not provided, the task will be referenced by the name property of a named function or a user-defined displayName property. The taskName parameter must be used for anonymous functions missing a displayName property.

Since any registered task can be run from the command line, avoid using spaces in task names.

parametertypenote
taskNamestringAn alias for the task function within the the task system. Not needed when using named functions for taskFunction.
taskFunction
(required)
functionA task function or composed task - generated by series() and parallel(). Ideally a named function. Task metadata can be attached to provide extra information to the command line.

Returns

When registering a task, nothing is returned.

When retrieving a task, a wrapped task (not the original function) registered as taskName will be returned. The wrapped task has an unwrap() method that will return the original function.

Errors

When registering a task where taskName is missing and taskFunction is anonymous, will throw an error with the message, "Task name must be specified".

Task metadata

propertytypenote
namestringA special property of named functions. Used to register the task.
Note: name is not writable; it cannot be set or changed.
displayNamestringWhen attached to a taskFunction creates an alias for the task. If using characters that aren't allowed in function names, use this property.
descriptionstringWhen attached to a taskFunction provides a description to be printed by the command line when listing tasks.
flagsobjectWhen attached to a taskFunction provides flags to be printed by the command line when listing tasks. The keys of the object represent the flags and the values are their descriptions.
const { task } = require('gulp');

const clean = function(cb) {
  // body omitted
  cb();
};
clean.displayName = 'clean:all';

task(clean);

function build(cb) {
  // body omitted
  cb();
}
build.description = 'Build the project';
build.flags = { '-e': 'An example flag' };

task(build);


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)