-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
35 lines (30 loc) · 1.07 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
/*global require*/
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var exec = require('gulp-exec');
var browserResolve = require('browser-resolve');
var packageJson = require('./package.json');
var browserify = require('gulp-browserify');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
gulp.task('lint', function () {
gulp.src(['**/*.js', '!**/*.min.js', '!node_modules/**/*.js', '!bower_components/**/*.js', '!coverage/**/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('test', ['lint'], function () {
gulp.src('test/index.js')
.pipe(exec('istanbul cover <%= file.path %>'));
});
gulp.task('build', function () {
browserResolve('./', {}, function (err, browserFile) {
gulp.src(browserFile)
.pipe(browserify())
.pipe(rename(packageJson.name + '.js'))
.pipe(gulp.dest('.'))
.pipe(rename(packageJson.name + '.min.js'))
.pipe(uglify({outSourceMap: true, preserveComments: 'some'}))
.pipe(gulp.dest('.'));
});
});
gulp.task('default', ['test', 'build']);