-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
58 lines (50 loc) · 1.21 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var watch = require('gulp-watch');
var concat = require('gulp-concat');
var ngTemplate = require('gulp-ng-template');
var rimraf = require('rimraf');
gulp.task('default', function() {
// place code for your default task here
});
gulp.task('sass', sassFunc);
gulp.task('watch', watchFunc);
gulp.task('templates', ['clean'], templatesFunc)
gulp.task('concat', ['templates'], concatFunc);
gulp.task('clean', cleanFunc);
function sassFunc() {
gulp.src('app/**/*.scss')
.pipe(sass())
.pipe(gulp.dest('css'));
}
function watchFunc() {
watch('app/**/*.scss', function () {
gulp.start('sass');
});
watch(['app/**/*.js', 'app/**/*.html'], function () {
gulp.start('concat');
});
}
function templatesFunc() {
return gulp.src('app/**/*.html')
.pipe(ngTemplate({
moduleName: 'app.templates',
standalone: true,
filePath: 'templates.js',
prefix: 'app/'
}))
.pipe(gulp.dest('js'));
}
function concatFunc() {
return gulp.src([
'js/templates.js',
'app/**/*.module.js',
'app/config/develop.js',
'!app/**/tests/*.js',
'app/**/*.js'])
.pipe(concat('all.js'))
.pipe(gulp.dest('js'));
}
function cleanFunc(cb) {
rimraf('./js', cb);
}