gulp Series Quick Start chapter

Quick Start

If you have previously installed a global gulp, please follow the instructions below to run . For more information, please read this Sip .npm rm --global gulp 

Check the node, npm and npx

node --version

Output: v8.11.1

npm --version

Output: 5.6.0

npx --version

Output: 9.7.1

If you have not installed, follow here the operation described .

Installation gulp command-line utility

npm install --global gulp-cli

Create a project directory and browse

npx mkdirp my-project
cd my-project

Creating package.json file in your project directory

npm init

This will guide your project name, version, description, and so on.

Installation gulp packages in your devDependencies

npm install --save-dev gulp

Verify your gulp version

gulp --version

And ensure that the output matches the screen shot below, or you might step in this guide needs to be restarted.

Output: CLI version 2.0.1 and version 4.0.0 Local

Create a gulpfile

Using a text editor, create a file named gulpfile.js in the project root directory, which contains the following:

function defaultTask(cb) {
  // place code for your default task here cb(); } exports.default = defaultTask

have a test

Run gulp command in the project directory:

gulp

To run multiple tasks, it can be used gulp <task> <othertask>.

result

The default task will run and not do anything.Output: The default start and completion of default

Guess you like

Origin www.cnblogs.com/tinys-top/p/12299281.html
Recommended