-
Notifications
You must be signed in to change notification settings - Fork 105
/
gulpfile.js
57 lines (52 loc) · 1.55 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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']);