First, the installation of Gulp
1. First make sure that you have the node. JS environment installed and then install the Gulp in a global manner
Global Installation Gulp---"" NPM install-g Gulp
2, after the global installation, switch to the Gulp project in a separate installation, the directory switch to the Gulp project
Local Area Installation Gulp---"" NPM Install Gulp
3, installation dependencies, that is, in the installation of the gulp written into the project Package.json file dependencies
NPM Install--save-dev Gulp
Second, start using gulp
1, like other front-end build tools, gulp also need a file as its main file, in Gulp, this file is called Gulpfile.js. Create a new file named Gulpfile.js, then put it in the project, and then define our task in the Gulpfile.js file.
At this point our directory structure is like this:
2, to run the Gulp task, only need to switch to the directory where the gulpfile.js file is stored, and then execute the Gulp command on the line, gulp can be added to perform the task name, such as: Command Gulp testless, if not add the task name, The default task is executed with the task named default.
Such as:
Tips and tricks for using the front-end build tool gulp.js