-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
59 lines (52 loc) · 1.48 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
// Include gulp
var gulp = require('gulp');
// Plugins
var jshint = require('gulp-jshint'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
karma = require('gulp-karma'),
ngAnnotate = require('gulp-ng-annotate');
// Lint Task
gulp.task('lint', function() {
return gulp.src('src/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
// Concatenate & Minify JS
gulp.task('build', ['lint'], function() {
return gulp.src('src/**/*.js')
.pipe(concat('angular-piwik.js'))
.pipe(ngAnnotate())
.pipe(gulp.dest('build'))
.pipe(rename('angular-piwik.min.js'))
.pipe(uglify())
.pipe(gulp.dest('build'));
});
gulp.task('test', function () {
return gulp.src('some_test_tile')
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
}))
.on('error', function(err) {
throw err;
});
});
gulp.task('watch-test', function () {
return gulp.src('some_test_tile')
.pipe(karma({
configFile: 'karma.conf.js',
action: 'start'
}))
.on('error', function(err) {
throw err;
});
});
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch(['src/**/*.js'], ['build']);
gulp.watch(['src/**/*.js', 'test/**/*.spec.js'], ['watch-test']);
});
// Default Task
gulp.task('default', ['test', 'lint', 'build', 'watch']);