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
npm --version
npx --version
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.
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.