Gulp Configuring backups

Source: Internet
Author: User
Tags tinypng

//Introduction of GulpvarGulp = require (' Gulp ')); //Introducing ComponentsvarClean = require (' Gulp-clean ');//-ClearvarSass = require (' Gulp-sass ');//-SASS CompilationvarConcat = require (' Gulp-concat ');//-MergervarUglify = require (' gulp-uglify ');//-Compression JSvarMinify = require (' gulp-minify-css ');//-Compress CSSvarRev = require (' Gulp-rev ');//-add MD5 suffix to file namevarRevcollector = require (' Gulp-rev-collector ');//-Path SubstitutionvarCompass = require (' Gulp-compass ');//CompassvarCssspriter = require (' Gulp-css-spriter ');//CSS Sprite ChartvarTinypng = require (' gulp-tinypng ');//tinypng Image Compression//Clear ResourcesGulp.task (' Clean ',function() {GULP.SRC (['./js/*.js '],['./css/*.css '],{read:false}). Pipe (Clean ())})//Compiling sassGulp.task (' sass ', [' Clean '],function() {GULP.SRC ('./sass/*.scss '). Pipe (Sass ()). Pipe (Minify ()). Pipe (Gulp.dest ('./css '));});//CompassGulp.task (' Compass ',function() {  varTimestamp = +NewDate (); GULP.SRC ('./sass/*.scss '). Pipe (Compass ({config_file:'./config.rb ', CSS:' CSS ', Sass:' Sass '}). Pipe (Cssspriter ({//the location of the generated SpriterSpritesheet: './dist/images/sprite ' +timestamp+ '. png ',        //generate the path to the style file picture reference address        //The following will be produced: Backgound:url (.. /images/sprite20324232.png)Pathtospritesheetfromcss: '. /images/sprite ' +timestamp+ '. png '}). Pipe (Gulp.dest ('./css '));});//merging, compressing filesGulp.task (' Concat ',function() {GULP.SRC ('./js/*.js '). Pipe (Concat (' All.js ') . Pipe (Uglify ()). Pipe (Gulp.dest ('./js ')); //. Pipe (Rev.manifest ());        //. Pipe (Gulp.dest ('./rev ')); });//to add a version number to a link, clear the cache//gulp.task (' rev ', function () {//gulp.src (['./rev/*.json ', './application/**/header.php '])//-read Rev-manifest.json files and files that need to be replaced by CSS names//. Pipe (Revcollector ())//-Replace the CSS name in the execution file//. Pipe (Gulp.dest ('./application/')); -the directory where the file output is replaced// });//image CompressionGulp.task (' Tinypng ',function() {GULP.SRC ('./images/* ')        //https://tinypng.com/developers Get Api_key        //https://tinypng.com/developers/subscription One months free 500 photos. Pipe (Tinypng (' P3A2PUL7IHVFIFPJFJ6KMNHOLS6KBGFW '). Pipe (Gulp.dest ('./dist/images '));});//Default TaskGulp.task (' Default ',function() {Gulp.watch (['./js/*.js ', './sass/*.scss ', [' concat ', ' compass ']);});

Gulp Configuring backups

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.