http://www.w3ctech.com/topic/134 (This article has a lot of errors) http://markpop.github.io/2014/09/17/Gulp%E5%85%A5%E9%97%A8%E6%95%99% e7%a8%8b/node init build package file NPM install-g Gulp Install Gulp command line tool $ NPM Install Gulp--save-dev installation in Project Gulp Gulp the profile name must be G Ulpfile.js is using gulp ' taskname ' command (not node!) First Gulp first try the most commonly used Jshint https://www.npmjs.com/package/gulp-jshint (the official documentation is very detailed) according to the official documents, but the official document is still a bit of a problem ....
varGulp = require (' Gulp ')), Jshint= Require (' Gulp-jshint '); Uglify= Require (' gulp-uglify ');varMap = require (' Map-stream '); Gulp.task (' Minify ',function() {GULP.SRC ('./qualitydata.js '). Pipe (Uglify ()). Pipe (Gulp.dest (' Build '))});varMyreporter = Map (function(file, CB) {if(!file.jshint.success) {Console.log (' Jshint fail in ' +File.path); File.jshint.results.forEach (function(err) {if(err) {//Console.log (err);Console.log (' +file.path + ': line ' + Err.error.line + ', col ' + Err.error.character + ', code ' + Err.error.code + ', ' +Err.error.reason); } }); } CB (NULL, file);}); Gulp.task (' Lint ',function() { returnGulp.src ('./qualitydata.js ')). Pipe (Jshint ())//. Pipe (myreporter);. Pipe (Jshint.reporter (' default ', {verbose:true }));});
Gulp starting from 0