-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
67 lines (58 loc) · 1.62 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
var gulp = require('gulp-help')(require('gulp'));
var eslint = require('gulp-eslint');
var karma = require('gulp-karma');
var connect = require('gulp-connect');
var uglify = require('gulp-uglify');
var ngAnnotate = require('gulp-ng-annotate');
var rename = require('gulp-rename');
gulp.task('connect', false, function() {
connect.server({
root: './',
livereload: true
});
});
gulp.task('html', false, function () {
gulp.src('./demos/simple/*.html')
.pipe(connect.reload());
});
gulp.task('js', false, function () {
gulp.src('./demos/simple/*.js')
.pipe(connect.reload());
});
gulp.task('watch', false, function () {
gulp.watch(['./demos/simple/*.html'], ['html']);
gulp.watch(['./demos/simple/*.js'], ['js']);
});
gulp.task('lint', false, function () {
return gulp.src(['src/*.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
});
gulp.task('test', 'Runs karma and lints code.', ['lint'], function() {
var testFiles = [
'bower_components/jquery/dist/jquery.js',
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'src/**/*.js',
'tests/**/*.js'
];
return gulp.src(testFiles)
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
}))
.on('error', function(err) {
throw err;
});
});
gulp.task('build', 'Builds project (concat, ngmin, uglify).', function () {
return gulp.src('src/*.js')
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest('build'));
});
gulp.task('serve', 'Launch dev environment', ['connect', 'watch']);