-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (50 loc) · 1.52 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
var gulp = require('gulp');
var uncss = require('gulp-uncss');
var sass = require('gulp-sass');
var csso = require('gulp-csso');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var plumber = require('gulp-plumber');
var templateCache = require('gulp-angular-templatecache');
gulp.task('sass', function() {
gulp.src('public/stylesheets/style.scss')
.pipe(plumber())
.pipe(sass())
.pipe(uncss({
html: [
'public/index.html',
'public/views/add.html',
'public/views/detail.html',
'public/views/home.html',
'public/views/login.html',
'public/views/signup.html'
]
}))
.pipe(csso())
.pipe(gulp.dest('public/stylesheets'));
});
gulp.task('compress', function() {
gulp.src([
'public/vendor/angular.js',
'public/vendor/*.js',
'public/app.js',
'public/services/*.js',
'public/controllers/*.js',
'public/filters/*.js',
'public/directives/*.js'
])
.pipe(concat('app.min.js'))
.pipe(uglify())
.pipe(gulp.dest('public'));
});
gulp.task('templates', function() {
gulp.src('public/views/**/*.html')
.pipe(templateCache({ root: 'views', module: 'MyApp' }))
.pipe(gulp.dest('public'));
});
gulp.task('watch', function() {
gulp.watch('public/stylesheets/*.scss', ['sass']);
gulp.watch('public/views/**/*.html', ['templates']);
gulp.watch(['public/**/*.js', '!public/app.min.js', '!public/templates.js', '!public/vendor'], ['compress']);
});
gulp.task('default', ['sass', 'compress', 'templates', 'watch']);