gulp-cli

Command Line Interface for gulp.
授权协议 MIT License
开发语言 JavaScript
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 淳于健
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

gulp-cli

Command Line Utility for Gulp

Install

npm install --global gulp-cli

Usage

> gulp [flags] <task> <task>...

Custom Metadata

When listing tasks with the gulp -T command, gulp-cli displays some custom metadata as defined upon task functions. Currently supported properties:

  • task.description - String of the description to display.
function clean() { ... }
clean.description = 'Cleans up generated files.';
  • task.flags - Object with key/value pairs being flag/description to display.
function build() { ... }
build.flags = {
  '--prod': 'Builds in production mode.'
};

Example Usage:

function build() { ... }
build.description = 'Build entire project.';
build.flags = {
  '--prod': 'Builds in production mode (minification, etc).'
};
// gulp 3.x
gulp.task('build', build);
// gulp 4.x
gulp.task(build);

Tasks

The task(s) listed on the command line will be executed.If more than one task is listed, Gulp will execute all of themconcurrently, that is, as if they had all been listed as dependencies ofa single task.

By default, Gulp does not serialize tasks listed on the command line. If you would like to execute tasks serially, you must specify the --series flag. e.g. gulp clean build --series

Just running gulp will execute the task default. If there is nodefault task, gulp will error.

Completion

Thanks to the grunt team, specifically Tyler Kellen

To enable tasks auto-completion in shell you should add eval "$(gulp --completion=shell)" in your .shellrc file.

Bash:

Add eval "$(gulp --completion=bash)" to ~/.bashrc.

Zsh:

Add eval "$(gulp --completion=zsh)" to ~/.zshrc.

Powershell:

Add Invoke-Expression ((gulp --completion=powershell) -join [System.Environment]::NewLine) to $PROFILE.

Fish:

Add gulp --completion=fish | source to ~/.config/fish/config.fish.

Compilers

You can find a list of supported languages at https://github.com/js-cli/js-interpret. If you would like to add support for a new language, send pull requests/open issues on that project.

Environment

The CLI adds process.env.INIT_CWD which is the original cwd it was launched from.

Configuration

Configuration is supported through the use of a .gulp.* file (e.g. .gulp.json, .gulp.yml). You can find a list of supported languages at https://github.com/js-cli/js-interpret.

Configuration from the home directory (~) and current working directory (cwd) are merged with cwd taking precedence.

Supported configurations properties:

Property Description
description Top-level description of the project/gulpfile (Replaces "Tasks for ~/path/of/gulpfile.js")
flags.continue Continue execution of tasks upon failure by default.
flags.compactTasks Reduce the output of task dependency tree by default.
flags.tasksDepth Set default depth of task dependency tree.
flags.gulpfile Set a default gulpfile
flags.silent Silence logging by default
flags.series Run tasks given on the CLI in series (the default is parallel)
flags.require An array of modules to require before running the gulpfile. Any relative paths will be resolved against the --cwd directory (if you don't want that behavior, use absolute paths)
flags.nodeFlags An array of flags used to forcibly respawn the process upon startup. For example, if you always want your gulpfiles to run in node's harmony mode, you can set --harmony here

Flags

gulp has very few flags to know about. All other flags are for tasks to use if needed.

Some flags only work with gulp 4 and will be ignored when invoked against gulp 3.

Flag Short Flag Description
--help -h Show this help.
--version -v Print the global and local gulp versions.
--require [path] Will require a module before running the gulpfile. This is useful for transpilers but also has other applications.
--gulpfile [path] -f Manually set path of gulpfile. Useful if you have multiple gulpfiles. This will set the CWD to the gulpfile directory as well.
--cwd [path] Manually set the CWD. The search for the gulpfile, as well as the relativity of all requires (including the `--require` flag) will be from here.
--verify [path (optional)] Will verify plugins referenced in project's package.json against the plugins blacklist.
--tasks -T Print the task dependency tree for the loaded gulpfile.
--tasks-simple Print a plaintext list of tasks for the loaded gulpfile.
--tasks-json [path] Print the task dependency tree, in JSON format, for the loaded gulpfile. The [path] argument is optional, and if given writes the JSON to the path.
--tasks-depth [number] Specify the depth of the task dependency tree to print. This flag can be used with --tasks or --tasks-json. (This flag was named --depth before but is deprecated.)
--compact-tasks Reduce the output of task dependency tree by printing only top tasks and their child tasks. This flag can be used with --tasks or --tasks-json.
--sort-tasks Will sort top tasks of task dependency tree. This flag can be used with --tasks.
--color Will force gulp and gulp plugins to display colors, even when no color support is detected.
--no-color Will force gulp and gulp plugins to not display colors, even when color support is detected.
--silent -S Suppress all gulp logging.
--continue Continue execution of tasks upon failure.
--series Run tasks given on the CLI in series (the default is parallel).
--log-level -L Set the loglevel. -L for least verbose and -LLLL for most verbose. -LLL is default.

License

MIT

  • Gulp介绍: gulp概念: 基于node开发的前端构建工具模块,将前端机械化的操作编写成任务自动化操作,类似于webpack构建,可以完成代码压缩、语法转换、抽离公共文件、自动实现浏览器刷新等。 基本使用步骤: 1.使用npm install gulp下载gulp库文件。 2.在项目文件夹中新建gulpfile.js文件,注意文件名固定不变。 3.重构项目文件夹目录结构:新建src文件夹(存放

  • 一般来说,脚手架是帮你减少「为减少重复性工作而做的重复性工作」的工具. gulp和gulp-cli的区别可以看这个task - what does gulp-"cli" stands for? . 它跟前端常说的脚手架(scaffold)不是一个东西. CLI只是Command Line Interface的缩写. ==== 举个例子 你要写一个项目0,源语言为ES6,用了sass, 后端是nod

  • gulp一直报Error: Cannot find module ‘gulp-concat’,按照网上说的一个一个试都不行 重新安装也不行 最后就按照他报错的信息 缺什么就安装什么 缺gulp-concat就npm install gulp-concat 然后就可以了

  • 1、Node.js说明 gulp是用JavaScript语言编写的运行在Node.js平台开发的前端构建工具,是前端开发人员自动处理日常任务的首选工具 gulp-cli:启动构建工具的命令行接口 本地gulp:构建时实际运行的程序 gulpfile.js:告诉gulp如何构建软件的指令文件 gulp插件:用于合并、压缩、修改文件的插件 2、全局安装gulp-cli gulp-cli是gulp的命令

  • 参考gulp官方 文档:快速入门 · gulp.js 中文文档 1.gulp是一个用于开发者在开发阶段用于自动化构建的一个工具 特点就是 简单、高效。 简单: 1.在项目中安装gulp 2.在根目录下新建一个gulpfi.js 用于编写我们需要gulp需要自动执行的构建任务。之后就可以在命令行终端使用gulp-cli 用于运行这个任务。 高效: 就是基于node的流(stream)能力,不写入磁盘

  • 一般来说,脚手架是帮你减少「为减少重复性工作而做的重复性工作」的工具. gulp和gulp-cli的区别可以看这个task - what does gulp-"cli" stands for? . 它跟前端常说的脚手架(scaffold)不是一个东西. CLI只是Command Line Interface的缩写. ==== 举个例子 你要写一个项目0,源语言为ES6,用了sass, 后端是nod

  • 目录 1. gulp的简介 2. gulp的安装         1.安装gulp          2.创建工程          3.引入gulp 3. gulp的基本使用         1.创建gulp任务         2.运行gulp任务  4. gulp的插件使用          1.创建处理html文件的任务          2.创建处理css文件的任务          3

 相关资料
  • 这篇快速上手指南将教你如何使用Gulp构建TypeScript,和如何在Gulp管道里添加Browserify,uglify或Watchify。 本指南还会展示如何使用Babelify来添加Babel的功能。 这里假设你已经在使用Node.js和npm了。 我们首先创建一个新目录。 命名为proj,也可以使用任何你喜欢的名字。 mkdir proj cd proj 我们将以下面的结构开始我们的工程

  • 更改历史 * 2017-11-12 杨海月 增加xxx内容,更改xxx内容,删除xxx内容 * 2017-11-01 胡小根 初始化文档 第一章 历史、现状及发展 1.1 gulp历史 gulp是前端开发过程中一种基于流的 代码构建工具 ,是自动化项目的构建利器;它不仅能对网站资源进行优化,而且在开发过程中很多重复的任务能够使用正确的工具自动完成;使用它,不仅可

  • 问题内容: 我想遍历一个对象,并在每次迭代时将文件路径数组传递给gulp.src,然后对这些文件进行一些处理。下面的代码仅用于说明目的,因为return语句会在第一次通过时终止循环,因此实际上将无法工作。 这是基本思想。有关如何执行此操作的任何想法? 问题答案: 我能够使用合并流实现这一目标。如果有人感兴趣,这里是代码。这个想法是在循环内创建一个流数组,并在完成迭代后合并它们:

  • 我安装了gulp,但我不能使用“gulp”命令,因为它会给我“-bash:gulp:command not found”错误。当我使用“NPX GULP”,然后它的工作,但我不知道为什么。

  • gulp-concat:文件合并 gulp-connect:在本地开启一个websocket服务,使用liveReload实现实时更新 gulp-watch:监听文件的变化,配合connect实现服务自动刷新 gulp-plumber:实时更新错误不会导致终端gulp运行开启的服务断开 gulp-livereload:即时重整 gulp-clean:清理档案 gulp-load-plugins:自

  • gulp-load-plugins Automatically load any gulp plugins in your package.json Install $ npm install --save-dev gulp-load-plugins Given a package.json file that has some dependencies within: { "depen

  • Glup 简明使用教程 安装: $ npm install gulp -g $ npm install gulp --save-dev 安装gulp插件 编译Sass(gulp-sass) (gulp-ruby-sass) 编译Less(gulp-less) Autoprefixer (gulp-autoprefixer) 缩小化(minify)CSS (gulp-minify-css) JSH

  • 支援 Gulp 4.0,允许嵌套配置任务及组态。以优雅、直觉的方式,重复使用 gulp 任务。 编码的时候你遵守 DRY 原则,那编写 gulpfile.js 的时候,为什么不呢? 功能 支援 Gulp 4.0, 自动载入本地 recipe, 支援透过 npm 安装 plugin, 支援嵌套任务并且允许子任务继承组态配置, 支援向前、向后参照任务, 透过组态配置即可处理串流:譬如 merge, q