gulpfile.js
795 Bytes
var gulp = require('gulp');
var fs = require('fs');
var exec = require('child_process').exec;
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var jsdoc = require("gulp-jsdoc");
var babel = require('gulp-babel');
gulp.task('default', function () {
gulp.src(["src/*.js"])
.pipe(jsdoc('./documentation'));
});
gulp.task('babel', function () {
return gulp.src('src/**/*.js')
.pipe(babel())
.pipe(gulp.dest('dist'));
});
//先编译成es5,再转文档
gulp.task('doc', ['babel'], function () {
return gulp.src(["dist/**/*.js"])
.pipe(jsdoc('./documentation'));
});
//js代码验证
gulp.task('hint', function () {
return gulp.src(['src/**/*.js'])
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});