-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
44 lines (37 loc) · 1.09 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
var
gulp = require('gulp'),
jscs = require('gulp-jscs'),
stylish = require('gulp-jscs-stylish'),
browserify = require('browserify'),
vinyl_transform = require('vinyl-transform'),
rename = require('gulp-rename'),
jshint = require('gulp-jshint'),
filelog = require('gulp-filelog'),
pkg = require('./package.json');
gulp.task('lint', function () {
var src = ['gulpfile.js', 'lib/**/*.js'];
return gulp.src(src)
.pipe(filelog('lint'))
.pipe(jshint('.jshintrc')) // enforce good practics
.pipe(jscs('.jscsrc')) // enforce style guide
.pipe(stylish.combineWithHintResults())
.pipe(jshint.reporter('jshint-stylish', {verbose: true}))
.pipe(jshint.reporter('fail'));
});
gulp.task('browserify', function () {
var
browserified,
src = pkg.main;
browserified = vinyl_transform(function (filename) {
var b = browserify(filename, {
standalone: pkg.name
});
return b.bundle();
});
return gulp.src(src)
.pipe(filelog('browserify'))
.pipe(browserified)
.pipe(rename(pkg.name + '.js'))
.pipe(gulp.dest('dist/'));
});
gulp.task('default', gulp.series('lint', 'browserify'));