-
Notifications
You must be signed in to change notification settings - Fork 185
/
gulpfile.js
136 lines (131 loc) · 4.88 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
var gulp = require('gulp');
var usemin = require('gulp-usemin');
var uglify = require('gulp-uglify');
var minifyHtml = require('gulp-minify-html');
var minifyCss = require('gulp-minify-css');
var rev = require('gulp-rev');
var replace = require('gulp-replace');
var eslint = require('gulp-eslint');
gulp.task('min', function() {
return gulp.src([
'src/main/webapp/WEB-INF/views/**/*.jsp'
])
.pipe(replace('href="<%= request.getContextPath() %>/bower', 'href="/bower'))
.pipe(replace('href="<%= request.getContextPath() %>/css', 'href="/css'))
.pipe(replace('src="<%= request.getContextPath() %>/bower', 'src="/bower'))
.pipe(replace('src="<%= request.getContextPath() %>/js', 'src="/js'))
.pipe(replace('<%= request.getContextPath() %>/EasyWizard', '/EasyWizard'))
.pipe(usemin({
css: [rev],
htmlmin: [ function () {return minifyHtml({ empty: true });} ],
js: [uglify, rev],
inlinejs: [ uglify ],
inlinecss: [ minifyCss, 'concat' ],
outputRelativePath: '../../'
}))
.pipe(replace('var _LOGGING_NOTIFY_DESKTOP = true;', 'var _LOGGING_NOTIFY_DESKTOP = false;'))
.pipe(replace('href="/bower', 'href="<%= request.getContextPath() %>/bower'))
.pipe(replace('href="/css', 'href="<%= request.getContextPath() %>/css'))
.pipe(replace('src="/bower', 'src="<%= request.getContextPath() %>/bower'))
.pipe(replace('src="/js', 'src="<%= request.getContextPath() %>/js'))
.pipe(replace('href="bower', 'href="<%= request.getContextPath() %>/bower'))
.pipe(replace('href="css', 'href="<%= request.getContextPath() %>/css'))
.pipe(replace('src="bower', 'src="<%= request.getContextPath() %>/bower'))
.pipe(replace('src="js', 'src="<%= request.getContextPath() %>/js'))
.pipe(gulp.dest('target/knowledge/WEB-INF/views/'));
});
gulp.task('copy', ['copy:bootswatch', 'copy:bootswatch2', 'copy:highlightjs', 'copy:font-awesome', 'copy:flag-icon-css',
'copy:html5shiv', 'copy:respond', 'copy:MathJax', 'copy:emoji-parser', 'copy:free-file-icons',
'copy:diff2html', 'copy:jsdiff', 'copy:jspdf', 'copy:pdfthema']);
gulp.task('copy:bootswatch', function() {
return gulp.src([
'src/main/webapp/bower/bootswatch/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/bootswatch'));
});
gulp.task('copy:bootswatch2', function() {
return gulp.src([
'src/main/webapp/bower/bootswatch/**/*.css'
])
.pipe(replace(/^@import url\("https:\/\/fonts.googleapis.com\/css.*\)\;/, ''))
.pipe(gulp.dest('target/knowledge/bower/bootswatch'));
});
gulp.task('copy:highlightjs', function() {
return gulp.src([
'src/main/webapp/bower/highlightjs/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/highlightjs'));
});
gulp.task('copy:font-awesome', function() {
return gulp.src([
'src/main/webapp/bower/font-awesome/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/font-awesome'));
});
gulp.task('copy:flag-icon-css', function() {
return gulp.src([
'src/main/webapp/bower/flag-icon-css/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/flag-icon-css'));
});
gulp.task('copy:html5shiv', function() {
return gulp.src([
'src/main/webapp/bower/html5shiv/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/html5shiv'));
});
gulp.task('copy:respond', function() {
return gulp.src([
'src/main/webapp/bower/respond/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/respond'));
});
gulp.task('copy:MathJax', function() {
return gulp.src([
'src/main/webapp/bower/MathJax/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/MathJax'));
});
gulp.task('copy:emoji-parser', function() {
return gulp.src([
'src/main/webapp/bower/emoji-parser/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/emoji-parser'));
});
gulp.task('copy:free-file-icons', function() {
return gulp.src([
'src/main/webapp/bower/teambox.free-file-icons/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/teambox.free-file-icons'));
});
gulp.task('copy:diff2html', function() {
return gulp.src([
'src/main/webapp/bower/diff2html/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/diff2html'));
});
gulp.task('copy:jsdiff', function() {
return gulp.src([
'src/main/webapp/bower/jsdiff/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/jsdiff'));
});
gulp.task('copy:jspdf', function() {
return gulp.src([
'src/main/webapp/bower/jspdf/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/jspdf'));
});
gulp.task('copy:pdfthema', function() {
return gulp.src([
'src/main/webapp/css/presentation-thema/**/*'
])
.pipe(gulp.dest('target/knowledge/css/presentation-thema'));
});
gulp.task('check', function () {
return gulp.src(['src/main/webapp/js/slide.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('default', ['min', 'copy']);