-
Notifications
You must be signed in to change notification settings - Fork 56
/
gulpfile.js
49 lines (39 loc) · 1.44 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
'use strict';
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
header = require('gulp-header'),
footer = require('gulp-footer'),
ngAnnotate = require('gulp-ng-annotate'),
gulpKarma = require('gulp-karma'),
pkg = require('./package.json'),
files = require('./files');
var karmaTestConfig = gulpKarma({configFile: 'karma.conf.js', action: 'run'});
gulp.task('build-js', function () {
return gulp.src(files.mergeFilesFor('src'))
.pipe(ngAnnotate())
.pipe(concat(pkg.name+'.js'))
.pipe(header('(function (angular, io) {\n\'use strict\''))
.pipe(footer('}(angular, io));'))
.pipe(gulp.dest('./build/'))
.pipe(concat(pkg.name+'.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./build/'));
});
gulp.task('dist-js', ['build-js'], function () {
return gulp.src('./build/*.js')
.pipe(gulp.dest('./dist/'));
});
gulp.task('test', function () {
return gulp.src(files.mergeFilesFor('karma-src')).pipe(karmaTestConfig);
});
gulp.task('test-build', ['build-js'], function () {
return gulp.src(files.mergeFilesFor('karma-build')).pipe(karmaTestConfig);
});
gulp.task('test-min', ['build-js'], function () {
return gulp.src(files.mergeFilesFor('karma-min')).pipe(karmaTestConfig);
});
gulp.task('watch', function () {
return gulp.watch('src/**/*.js', ['build-js']);
});
gulp.task('default', ['build-js', 'watch']);