-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
77 lines (69 loc) · 1.86 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
"use strict";
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var coveralls = require('gulp-coveralls');
var cssmin = require('gulp-cssmin');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var karma = require('karma').server;
var _coverage = 'coverage/**/lcov.info';
var _scripts = 'src/**/*.js';
var _styles = 'src/**/*.css';
var _script = 'ng-pull.js';
var _style = 'ng-pull.css';
var _dist = 'dist';
gulp.task('build-css', function () {
return gulp.src(_styles)
.pipe(concat(_style))
.pipe(gulp.dest(_dist))
.pipe(cssmin())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(_dist));
})
gulp.task('build', ['unit-test', 'build-css'], function () {
return gulp.src(_scripts)
.pipe(concat(_script))
.pipe(gulp.dest(_dist))
.pipe(uglify())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(_dist));
})
gulp.task('dist', ['build-css'], function () {
return gulp.src(_scripts)
.pipe(concat(_script))
.pipe(gulp.dest(_dist))
.pipe(uglify())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(_dist));
})
gulp.task('watch',['build'], function(){
gulp.watch('src/**/*', ['build']);
gulp.watch('tests/**/*', ['unit-test']);
});
gulp.task('unit-test', function (done) {
var _opts = {
configFile: __dirname + '/karma.conf.js',
singleRun: true,
browsers: ['Firefox']
};
karma.start(_opts, done);
})
gulp.task('test', function (done) {
var _opts = {
configFile: __dirname + '/karma.conf.js',
singleRun: true,
browsers: ['PhantomJS', 'Firefox', 'IE']
};
karma.start(_opts, done);
})
gulp.task('coverage', ['unit-test'], function () {
gulp
.src(_coverage)
.pipe(coveralls());
})