-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
69 lines (56 loc) · 1.61 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
(function (require, process) {
let gulp = require('gulp');
let concat = require('gulp-concat');
let templateCache = require('gulp-angular-templatecache');
let del = require('del');
let runSequence = require('run-sequence');
let eslint = require('gulp-eslint');
let es = require('event-stream');
let dist = 'release';
/*-------------------------------*/
gulp.task('clean', function (cb) {
del([dist], cb);
});
gulp.task('scripts', function () {
let src = [
'src/module.js',
'src/services/countdownService.js',
'src/components/countdownModel/countdownModel.js',
'src/**/*.js'
];
return es.merge(gulp.src(src))
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError())
.pipe(concat('angular-countdown.js'))
.pipe(gulp.dest(dist));
});
gulp.task('templates', function () {
return es.merge(gulp.src(dist + '/angular-countdown.js'), getTemplatesStream())
.pipe(concat('angular-countdown.js'))
.pipe(gulp.dest(dist));
});
function getTemplatesStream() {
let src = ['src/**/*.html'];
return gulp.src(src)
.pipe(templateCache('templates.js', {
module: 'tkdCountdown',
standalone: false,
root: 'src/'
}));
}
gulp.task('styles', function () {
let src = 'src/**/*.css';
return gulp.src(src)
.pipe(concat('angular-countdown.css'))
.pipe(gulp.dest(dist));
});
gulp.task('build', function (cb) {
runSequence(
'clean',
'scripts',
['templates', 'styles'],
cb);
});
gulp.task('default', ['build']);
})(require, process);