- Gulp Getting Started
- Gulp Browser Real-time synchronization
First to download the corresponding plug-in package;
Gulp-less Package: cnpm Install gulp-less--save-dev
Gulp-connect Package: cnpm Install Gulp-connect--save-dev
GULP-MINIFY-CSS Package: cnpm Install Gulp-minify-css--save-dev
var gulp=require (' Gulp '), gulp_less=require (' gulp-less '), gulp_connect=require (' Gulp-connect '), Gulp_minify_css=require (' gulp-minify-css ');//"Perform multiple Tasks" in a task Gulp.task (' Serves ', function () { //Create a server, The port defaults to 8080 gulp_connect.server ({ //root: root : ' Web ', livereload:true }); Dynamic monitoring Gulp.watch (' web/**/*.* ', [' Reload ', ' less ']); /Deploy Action command-reloadgulp.task (' Reload ', function () { gulp.src (' web/**/*.* ') . Pipe (Gulp_connect.reload ());}); /Deploy Action-lessgulp.task (' less ', function () { gulp.src (' web/less/*.less ') . Pipe (Gulp_less ()) . PIPE ( Gulp_minify_css ()) . Pipe (Gulp.dest (' web/css/')});
Gulp compression css,less to CSS, browser real-time Refresh "original"