My gulp.js list.

Source: Internet
Author: User

var gulp = require (' Gulp '), Cssmin = require (' gulp-clean-css '),//compress css file Concat = require (' Gulp-concat '),/ /merge js file Jsmin = require (' gulp-uglify '),//compress js file Imgmin = require (' gulp-imagemin '),//Picture Compression rename = R Equire (' Gulp-rename '),//File Rename Jshint = require (' Gulp-jshint '),//js file Check rev = require (' Gulp-rev '),//-to file name Add MD5 suffix revcollector = require (' Gulp-rev-collector '),//path Replace connect = require (' Gulp-connect '); Configure the local server//######## #文件监听及自动刷新网页start ################ #gulp. Task (' Connect ', function () {Connect.server ({host: ') localhost ',//address, can not write, do not write, default localhost port:3000,//port number, can not write, default 8000 root: './',//Current project home directory Livereload: True//Auto-refresh}); Gulp.task (' HTML ', function () {gulp.src ('./bill/*.html '). Pipe (Connect.reload ());}); Gulp.task (' Watch ', function () {Gulp.watch ('./bill/css/*.css ', [' html ']);//monitor CSS file Gulp.watch ('./bill/js/*.js ', [' HTML ']); Monitor JS file Gulp.watch (['./bilL/*.html '], [' HTML ']); Monitor HTML file}), Gulp.task (' Server ', [' Connect ', ' Watch ']),//######## #文件监听及自动刷新网页end ################ #gulp. Task (' Cssmin ', function () {GULP.SRC ("bill/css/common.css"). Pipe (rename ({suffix: '. Min '}). Pipe (CSSM                In ({dubug:true}, function (Details) {console.log (details);                Console.log (Details.name + ' (originalsize): ' + details.stats.originalSize);            Console.log (Details.name + ' (minifiedsize): ' + details.stats.minifiedSize); }). Pipe (rev ()). Pipe (Gulp.dest ("Bill/css")). Pipe (Rev.manifest ())//-generates a rev-manifest. JSON. PIPE (Gulp.dest (' bill/css ');}); Gulp.task (' Jsmin ', function () {GULP.SRC ("bill/js/common.js"). Pipe (rename ({suffix: '. Min '}). P Ipe (Jsmin ()). Pipe (rev ()). Pipe (Gulp.dest ("Bill/js")). Pipe (Rev.manifest ())//-generate a Rev-m Anifest.json. Pipe (Gulp.dest (' Bill/js ');}); gulp.tAsk (' Imgmin ', function () {GULP.SRC ("src/img/*.jpg"). Pipe (Imgmin ({optimizationlevel:5,// Type: Number default: 3 Value range: 0-7 (Optimization level) progressive:true,//Type: Boolean default: False lossless compression jpg picture interlace D:true,//Type: Boolean default: False interlaced GIF for rendering multipass:true//Type: Boolean default: False optimize SVG multiple times until full optimization} ). Pipe (Gulp.dest ("dist/img");}); Gulp.task (' rev ', function () {GULP.SRC (['./bill/**/*.json ', "./bill/index.html"])//-read the Rev-manifest.json file and need to replace the file. Pipe (Revcollector ({replacereved:true, D                    Irreplacements: {' css ': ' CSS ', ' js ': ' JS '} })//-executes the name of the file. Pipe (Gulp.dest ('./bill ')); -Replace the file output directory});//Perform configuration Tasks Gulp.task (' Default ', [' cssmin ', ' jsmin ', ' rev '], function () {//Gulp.start (' Testjsmin ');}) ;

  

My gulp.js list.

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.