forked from secusu/web-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
86 lines (80 loc) · 2.66 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
var gulp = require('gulp'),
gutil = require('gulp-util'),
sass = require('gulp-sass'),
closureCompiler = require('gulp-closure-compiler'),
htmlmin = require('gulp-htmlmin'),
notify = require("gulp-notify");
gulp.task('build-css', function() {
return gulp.src('source/css/app.scss')
.pipe(sass({outputStyle: 'compressed'}))
.pipe(gulp.dest('public/css'))
.pipe(notify({
title: "SËCU",
message: "CSS compiled"
}));
});
gulp.task('build-js', function() {
return gulp.src([
'source/js/sjcl.js',
'source/js/socket.io.js',
'source/js/ractive.js',
'source/js/ractive-events-tap.js',
'source/js/ractive-events-keys.js',
'source/js/autolinker.js',
'source/js/promise.js',
'source/js/ajax.js',
'source/js/socket.js',
'source/js/crypt.js',
'source/js/helpers.js',
'source/js/file.js',
'source/js/errors.js',
'source/js/chat.js',
'source/js/notifications.js',
'source/js/main.js'
])
.pipe(closureCompiler({
compilerPath: 'node_modules/google-closure-compiler/compiler.jar',
fileName: 'app.js',
compilerFlags: {
language_in: 'ES5',
//compilation_level: 'WHITESPACE_ONLY',
compilation_level: 'SIMPLE_OPTIMIZATIONS',
warning_level: 'QUIET'
}
}))
.pipe(gulp.dest('public/js'))
.pipe(notify({
title: "SËCU",
message: "JS compiled"
}));
});
gulp.task('build-html', function() {
return gulp.src('source/html/*.html')
.pipe(htmlmin({
collapseWhitespace: true,
conservativeCollapse: true,
removeComments: true,
removeCommentsFromCDATA: true,
removeCDATASectionsFromCDATA: true,
removeTagWhitespace: true,
removeAttributeQuotes: true,
preventAttributesEscaping: true,
useShortDoctype: true,
caseSensitive: true,
includeAutoGeneratedTags: false
}))
.pipe(gulp.dest('public'))
.pipe(notify({
title: "SËCU",
message: "HTML compiled"
}));
});
gulp.task('watch', function() {
gulp.watch('source/css/*.scss', ['build-css']);
gulp.watch('source/js/*.js', ['build-js']);
gulp.watch('source/html/*.html', ['build-html']);
});
gulp.start('build-css', 'build-js', 'build-html');
gulp.task('default', ['watch'], function() {
return gutil.log('Gulp gulp gulp...');
});