-
Notifications
You must be signed in to change notification settings - Fork 18
/
gulpfile.js
62 lines (52 loc) · 1.38 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
58
59
60
61
62
(function () {
'use strict';
var wiredep = require('wiredep');
var gulp = require('gulp');
var $ = require('gulp-load-plugins')({
pattern: ['gulp-*']
});
var testFiles;
gulp.task('preparetestfiles', function () {
var bowerDeps = wiredep({
directory: 'bower_components',
dependencies: true,
devDependencies: true
});
testFiles = bowerDeps.js.concat([
'src/**/*.js',
'test/unit/*.js',
]);
});
gulp.task('test', ['preparetestfiles'], function() {
return gulp.src(testFiles)
.pipe($.karma({
configFile: 'karma.conf.js',
action: 'run'
}))
.on('error', function(err) {
// Make sure failed tests cause gulp to exit non-zero
throw err;
});
});
gulp.task('jshint', function () {
return gulp.src(['.tmp/**/*.js'])
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.jshint.reporter('fail'));
});
gulp.task('compress', function() {
return gulp.src(['.tmp/**/*.js'])
.pipe($.uglify())
.pipe($.concat('elif.min.js'))
.pipe(gulp.dest('./'))
.pipe($.size());
});
gulp.task('concat', function() {
return gulp.src(['.tmp/**/*.js'])
.pipe($.concat('elif.js'))
.pipe(gulp.dest('./'))
.pipe($.size());
});
gulp.task('default', ['build']);
gulp.task('build', ['test', 'jshint', 'compress', 'concat']);
})();