-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
84 lines (79 loc) · 1.74 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
var gulp = require('gulp');
var connect = require('gulp-connect');
var karma = require('gulp-karma');
var uglify = require('gulp-uglify');
var ngAnnotate = require('gulp-ng-annotate');
var rename = require('gulp-rename');
/**
* @ngdoc object
* @name gulpTasks.demo
* @description
* Runs a webserver (with LiveReload)
* Serves the demo
* {@link https://github.com/avevlad/gulp-connect gulp-connect}
*/
gulp.task('demo', function () {
connect.server({
root: '.',
port: 9000,
livereload: true
});
});
/**
* @ngdoc object
* @name gulpTasks.watch
* @description
* Reloads demo
* Uses:
* {@link https://github.com/avevlad/gulp-connect gulp-connect}
*/
gulp.task('watch', function () {
gulp.src('demo/*')
.pipe(connect.reload());
});
/**
* @ngdoc object
* @name gulpTasks.default
*/
gulp.task('default', [
'demo'
]);
/**
* @ngdoc object
* @name gulpTasks.test
* @description
* Runs unit tests
* {@link https://github.com/lazd/gulp-karma gulp-karma }
*/
gulp.task('test', function () {
//Use a fake src to run the tests specified in the karma config file
return gulp.src('./unit')
.pipe(karma({
configFile: 'test/karma.conf.js',
action: 'run',
singleRun: true
}))
.on('error', function (err) {
console.log(err);
this.emit('end');
});
});
/**
* @ngdoc object
* @name gulpTasks.build
* @description
* Annotate and uglify the source code
* {@link https://www.npmjs.com/package/gulp-ng-annoatate }
* {@link https://www.npmjs.com/package/gulp-uglify }
*/
gulp.task('build', function() {
return gulp.src('src/*.js')
.pipe(ngAnnotate())
.pipe(uglify({
preserveComments: 'license'
}))
.pipe(rename({
suffix: ".min"
}))
.pipe(gulp.dest('dist'));
});