-
Notifications
You must be signed in to change notification settings - Fork 196
/
gulpfile.js
74 lines (66 loc) · 1.9 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
var gulp = require('gulp');
var csso = require('gulp-csso');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var recess = require('gulp-recess');
var header = require('gulp-header');
var gulpFilter = require('gulp-filter');
var complexity = require('gulp-complexity');
var ngAnnotate = require('gulp-ng-annotate');
var templateCache = require('gulp-angular-templatecache');
var banner = ['/**',
' * Instagram Demo',
' * (c) 2014 Author Name',
' * License: MIT',
' * Last Updated: <%= new Date().toUTCString() %>',
' */',
''].join('\n');
gulp.task('minify', function() {
var templatesFilter = gulpFilter('clients/views/*.html');
return gulp.src([
'client/vendor/angular.js',
'client/vendor/*.js',
'client/app.js',
'client/templates.js',
'client/controllers/*.js',
'client/services/*.js',
'client/directives/*.js'
])
.pipe(templatesFilter)
.pipe(templateCache({ root: 'views', module: 'Instagram' }))
.pipe(templatesFilter.restore())
.pipe(concat('app.min.js'))
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(header(banner))
.pipe(gulp.dest('client'));
});
gulp.task('complexity', function() {
return gulp.src([
'!client/vendor/*.*',
'!client/app.min.js',
'client/**/*.js'
])
.pipe(complexity());
});
gulp.task('styles', function() {
gulp.src([
'client/css/bootstrap.css',
'client/css/sweet-alert.css',
'client/css/styles.css'
])
.pipe(concat('styles.min.css'))
.pipe(csso())
.pipe(gulp.dest('client/css'));
});
gulp.task('recess', function() {
gulp.src('client/css/styles.css')
.pipe(recess())
.pipe(recess.reporter())
.pipe(gulp.dest('client/css'));
});
gulp.task('watch', function() {
gulp.watch('client/css/*.css', ['styles']);
gulp.watch(['client/js/**/*.js', '!client/app.min.js', '!client/vendor'], ['minify']);
});
gulp.task('default', ['watch', 'styles', 'minify']);