-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
77 lines (68 loc) · 2.25 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
var gulp = require('gulp');
var minifyHTML = require('gulp-minify-html');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var ngAnnotate = require('gulp-ng-annotate');
var minifyCSS = require('gulp-minify-css');
var banner = ['/**',
' * Map attack',
' * 2015 by panagiop',
' * License: MIT',
' * Last Updated: <%= new Date().toUTCString() %>',
' */',
''].join('\n');
gulp.task('minifyjs', function() {
gulp.src([
'client/bower_components/angular/angular.js',
'client/bower_components/angular-ui-router/release/angular-ui-router.js',
'client/bower_components/angular-resource/angular-resource.js',
// 'client/public/js/lib/*.js',
'client/public/js/app.js',
'client/public/js/**/*.js',
'client/bower_components/jquery/dist/jquery.js',
'client/bower_components/bootstrap/dist/js/bootstrap.js',
'client/bower_components/socket.io-client/socket.io.js',
'client/bower_components/lodash/lodash.js',
'client/bower_components/ngmap/build/scripts/ng-map.min.js'
// 'client/public/theme/assets/js/*.js'
])
.pipe(concat('app.min.js'))
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(gulp.dest('client/public/js'));
});
// minify new or changed HTML pages
gulp.task('minifyhtml', function() {
var htmlSrc = [
'client/views/partials/**/*.html',
'client/public/js/common/directives/**/*.html'
],
htmlDst = 'client/public/templates';
gulp.src(htmlSrc)
.pipe(minifyHTML())
.pipe(gulp.dest(htmlDst));
});
gulp.task('minifycss', function() {
gulp.src([
'client/public/theme/assets/css/*.css',
'client/public/theme/assets/css/custom-style.css',
'client/bower_components/bootstrap/dist/css/bootstrap.css'
])
.pipe(concat('styles.min.css'))
.pipe(minifyCSS({processImport: false}))
.pipe(gulp.dest('client/public/css'));
});
gulp.task('watch', function() {
gulp.watch([
'client/public/theme/assets/css/*.css',
'!client/css/styles.min.css'
], ['minifycss']);
gulp.watch([
'client/public/js/**/*.js',
'client/public/js/app.js'
], ['minifyjs']);
gulp.watch([
'client/views/partials/**/*.html'
], ['minifyhtml']);
});
gulp.task('default', ['watch', 'minifycss', 'minifyjs', 'minifyhtml']);