Demo of Gulp

Source: Internet
Author: User

1. Installing Gulp

CNPM Install-g Gulp;

2. Then also need to install Gulp in the current directory, specifically, only know that after the installation will be in the current directory under the Node_modules more than one Gulp folder

CNPM Install Gulp--save-dev

There's a great God who knows, and he's looking for guidance.

3. Create Package.json, you can cnpm init or write yourself manually, the content is as follows

{"Name": "Gulptest", "Version": "1.0.0", "description": "description", "Main": "Gulpfile.js", "dependencies": {"Gulp": " ^3.9.0 "," Gulp-rename ":" ^1.2.2 "," Gulp-jshint ":" ^1.11.2 "," Gulp-concat ":" ^2.6.0 "," gulp-uglify ":" ^1.4.0 "," Gulp-util ":" ^1.0.0 "}," Devdependencies ": {" Gulp ":" ^3.9.0 "}," scripts ": {" test ":" Test Command "}," repository ": {" type " : "Git", "url": "Git Repository"}, "keywords": ["keywords"], "author": "Author", "License": "ISC"}

4. Installation-related dependencies

CNPM Install

5. Create gulpfile.js with the following content

var Gulp    = require (' gulp '); var gutil    = require (' Gulp-util '); var uglify  = require (' gulp-uglify '); var Concat  = require (' Gulp-concat '); Gulp.task (' Concat ', function () {    gulp.src ('./src/*.js ')        . Pipe (Uglify ( )        . Pipe (concat (' all.min.js '))        . Pipe (Gulp.dest ('./build '));}); Gulp.task (' Default ', [' concat ']);

6. Execute gulp and you will see the following results

Demo of Gulp

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.