gulp
gulp 操作
安装
1 | npm install --global gulp-cli |
压缩 JS
1 | npm install gulp-uglify --save-dev |
/js/test.js
1 | function formatDate(date) { |
gulpfile js
1 | var gulp = require('gulp'); |
压缩完成 /dist/test.js
1 | function formatDate(t){return(new Date).toLocaleString()}function year(){return(new Date).getFullYear()}function month(){return(new Date).getMonth()}function day(){return(new Date).getDay()} |
压缩 CSS
css/test.css
1 | * { |
gulpfile css
1 | var cleanCss = require('gulp-clean-css'); |
/dist/test.css
1 | *{padding:0;margin:0}div{padding:0 20px} |
压缩图片
gulpfile css
1 | var imagemin = require('gulp-imagemin'); |
编译less
gulpfile less
1 | var less = require('gulp-less'); |