-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
103 lines (86 loc) · 2.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
minifyCSS = require('gulp-minify-css'),
concat = require('gulp-concat'),
notify = require("gulp-notify"),
jade = require("gulp-jade"),
plumber = require("gulp-plumber"),
shell = require('gulp-shell'),
runSequence = require('run-sequence');
function onError(error) {
console.log('FATAL ERROR: ' + error);
console.log(error);
console.log('----- EXITING -----');
process.exit(1);
}
gulp.task('clean', shell.task([
'mvn clean -P server',
'mvn clean -P client'
]));
gulp.task('buildServer', shell.task(
'mvn generate-sources -P server'
));
gulp.task('buildClient', shell.task(
'mvn generate-sources -P client'
));
gulp.task('buildClientAndServer', shell.task([
'mvn generate-sources -P server',
'mvn generate-sources -P client'
]));
//VENDORS
gulp.task('bundleJsVendors', function() {
return gulp.src([
'bower_components/jquery/dist/jquery.min.js',
'bower_components/hammerjs/hammer.min.js',
'bower_components/angular/angular.js',
'node_modules/socket.io-client/dist/socket.io.js',
'bower_components/angular-route/angular-route.js',
'bower_components/angular-aria/angular-aria.js',
'bower_components/angular-animate/angular-animate.js',
'bower_components/angular-material/angular-material.js',
'bower_components/ng-socket-io/ng-socket-io.js',
])
.pipe(concat('vendors.js'))
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('build/js/'))
.on('error', onError);
});
gulp.task('bundleCss', function () {
return gulp.src([
'bower_components/foundation/css/foundation.css',
'bower_components/angular-material/angular-material.css',
'css/style.css',
])
.pipe(minifyCSS())
.pipe(concat('bundle.css'))
.pipe(gulp.dest('build/css'))
.on('error', onError);
});
gulp.task('jade', function() {
return gulp.src([
'index.jade',
])
.pipe(jade())
.pipe(gulp.dest('build/'))
.on('error', onError);
});
gulp.task('views', function() {
return gulp.src([
'views/**/*',
])
.pipe(gulp.dest('build/views'))
.on('error', onError);
});
gulp.task('images', function() {
return gulp.src([
'img/**/*',
])
.pipe(gulp.dest('build/img'))
.on('error', onError);
});
gulp.task('static', ['jade', 'bundleJsVendors', 'bundleCss', 'views', 'images']);
gulp.task('all', ['clean'], function (cb) {
runSequence(['buildClientAndServer', 'static'], cb);
});