加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gulpfile.js 1.55 KB
一键复制 编辑 原始数据 按行查看 历史
Daniele Polencic 提交于 2017-06-05 22:15 . uglified library
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var yuidoc = require('gulp-yuidoc');
// var jsdoc = require('gulp-jsdoc');
var zip = require('gulp-zip');
var babelify = require('babelify');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var info = require('./package.json');
var NAME = 'behavior3-'+info.version;
/**
* Apply jshint to the source and print results on terminal.
*/
gulp.task('_jshint', function() {
return gulp.src(['src/b3.js', 'src/**/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('_build', function() {
return browserify('./src/index.js', {standalone: 'b3'})
.transform(babelify, {
presets: ['es2015']
})
.transform('uglifyify')
.bundle()
.pipe(source('bundled-app.js'))
.pipe(buffer())
.pipe(rename(NAME+'.js'))
.pipe(gulp.dest('./libs'));
});
/**
* Generate YUIDOCS
*/
gulp.task('_docs', function() {
var OPTS = {
'themedir': 'docs/theme',
'helpers': ['docs/theme/helpers.js'],
}
return gulp.src(['src/b3.js', 'src/**/*.js'])
.pipe(yuidoc(OPTS, OPTS))
.pipe(gulp.dest('./docs/'+NAME))
.pipe(zip(NAME+'.docs.zip'))
.pipe(gulp.dest('./docs/'))
});
//
gulp.task('dev', function() {
gulp.watch('src/**/*.js', ['_jshint']);
})
gulp.task('build', ['_build', '_docs']);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化