Tips and tricks for using the front-end build tool gulp.js

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.