-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile-old.js
216 lines (175 loc) · 7.08 KB
/
gulpfile-old.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
require('es6-promise').polyfill();
// Defining base pathes
var basePaths = {
packages: './node_modules/',
temp: './tmp/',
target: './static/',
assets: './assets/'
};
// requirements
var gulp = require('gulp');
var concat = require('gulp-concat');
var cssnano = require('gulp-cssnano');
var googleWebFonts = require('gulp-google-webfonts');
var plumber = require('gulp-plumber');
var rename = require('gulp-rename');
var replace = require('gulp-replace');
var rimraf = require('gulp-rimraf');
var sass = require('gulp-sass');
var uglify = require('gulp-uglify');
var watch = require('gulp-watch');
// gulp watch
gulp.task('watch', function () {
// JS
gulp.watch(basePaths.assets + 'js/*.js', ['copy-assets-webapp-js', 'concat-js']);
// CSS
gulp.watch(basePaths.assets + 'sass/*.scss', ['copy-assets-webapp-css', 'sass', 'concat-css']);
});
/*
*
*/
gulp.task('copy-assets-webapp-css', [], function () {
return gulp.src(basePaths.assets + 'sass/**/*.scss')
.pipe(gulp.dest(basePaths.temp + 'sass/webapp/'));
});
/*
*
*/
gulp.task('sass', ['copy-assets-webapp-css'], function () {
return gulp.src(basePaths.temp + 'sass/*.scss')
.pipe(plumber())
.pipe(sass({noCache: true}))
.pipe(gulp.dest(basePaths.temp + 'css/'));
});
/*
*
*/
gulp.task('concat-css', ['copy-assets-webapp-css', 'sass'], function () {
return gulp.src(basePaths.temp + 'css/base.css')
.pipe(plumber())
.pipe(rename({suffix: '.min'}))
//.pipe(cssnano({discardComments: {removeAll: true}})) // comment out for devel
.pipe(concat('webapp.min.css'))
.pipe(gulp.dest(basePaths.target + 'css/'));
});
/*
*
*/
gulp.task('copy-assets-webapp-js', [], function () {
// Own JS Assets
return gulp.src(basePaths.assets + 'js/*')
.pipe(gulp.dest(basePaths.temp + 'js/webapp/'));
});
/*
*
*/
gulp.task('concat-js', ['copy-assets-webapp-js'], function () {
return gulp.src([
basePaths.temp + 'js/jquery/jquery.js',
basePaths.temp + 'js/popper.js/popper.min.js',
basePaths.temp + 'js/bootstrap/bootstrap.js',
basePaths.temp + 'js/bootstrap-multiselect/bootstrap-multiselect.js',
basePaths.temp + 'js/bootstrap-datepicker/bootstrap-datepicker.js',
basePaths.temp + 'js/bootstrap-datepicker/bootstrap-datepicker.de.min.js',
basePaths.temp + 'js/bootstrap-slider/bootstrap-slider.js',
basePaths.temp + 'js/mapbox-gl/mapbox-gl-dev.js',
basePaths.temp + 'js/ekko-lightbox/ekko-lightbox.js',
basePaths.temp + 'js/livesearch/livesearch.js',
basePaths.temp + 'js/webapp/*'
])
.pipe(concat('webapp.min.js'))
//.pipe(uglify()) // comment out for devel
.pipe(gulp.dest(basePaths.target + './js/'));
});
/*
*
*/
gulp.task('copy-assets', function () {
/********** JS **********/
// jQuery
gulp.src(basePaths.packages + 'jquery/dist/*.js')
.pipe(gulp.dest(basePaths.temp + 'js/jquery'));
// Popper
gulp.src(basePaths.packages + 'popper.js/dist/umd/popper.min.js')
.pipe(gulp.dest(basePaths.temp + 'js/popper.js'));
// Bootstrap
gulp.src(basePaths.packages + 'bootstrap/dist/js/bootstrap.js')
.pipe(gulp.dest(basePaths.temp + 'js/bootstrap'));
// Bootstrap Multiselect
gulp.src(basePaths.packages + 'bootstrap-multiselect/dist/js/*.js')
.pipe(gulp.dest(basePaths.temp + 'js/bootstrap-multiselect'));
// Bootstrap Datepicker
gulp.src(basePaths.packages + 'bootstrap-datepicker/dist/js/bootstrap-datepicker.js')
.pipe(gulp.dest(basePaths.temp + 'js/bootstrap-datepicker'));
gulp.src(basePaths.packages + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.de.min.js')
.pipe(gulp.dest(basePaths.temp + 'js/bootstrap-datepicker'));
// Bootstrap Slider
gulp.src(basePaths.packages + 'bootstrap-slider/dist/bootstrap-slider.js')
.pipe(gulp.dest(basePaths.temp + 'js/bootstrap-slider'));
// Bootstrap Lightbox
gulp.src(basePaths.packages + 'ekko-lightbox/dist/ekko-lightbox.js')
.pipe(gulp.dest(basePaths.temp + 'js/ekko-lightbox'));
// Mapbox GL
gulp.src(basePaths.packages + 'mapbox-gl/dist/mapbox-gl-dev.js')
.pipe(gulp.dest(basePaths.temp + 'js/mapbox-gl'));
// LiveSearch
gulp.src(basePaths.assets + 'js/livesearch.js')
.pipe(gulp.dest(basePaths.temp + 'js/livesearch/'));
// Own JS Assets
gulp.src(basePaths.assets + 'js/*')
.pipe(gulp.dest(basePaths.temp + 'js/webapp/'));
/********** SASS **********/
// Base
gulp.src(basePaths.assets + 'base/base.scss')
.pipe(gulp.dest(basePaths.temp + 'sass/'));
// Normalize
gulp.src(basePaths.packages + 'normalize.css/normalize.css')
.pipe(rename('normalize.scss'))
.pipe(gulp.dest(basePaths.temp + 'sass/normalize.css/'));
// Bootstrap
gulp.src(basePaths.packages + 'bootstrap/scss/**/*.scss')
.pipe(gulp.dest(basePaths.temp + 'sass/bootstrap/'));
// Bootstrap Multiselect
gulp.src(basePaths.packages + 'bootstrap-multiselect/dist/css/bootstrap-multiselect.css')
.pipe(rename('bootstrap-multiselect.scss'))
.pipe(gulp.dest(basePaths.temp + 'sass/bootstrap-multiselect/'));
// Bootstrap Slider
gulp.src(basePaths.packages + 'bootstrap-slider/dist/css/bootstrap-slider.css')
.pipe(rename('bootstrap-slider.scss'))
.pipe(gulp.dest(basePaths.temp + 'sass/bootstrap-slider/'));
// Bootstrap Datepicker
gulp.src(basePaths.packages + 'bootstrap-datepicker/dist/css/bootstrap-datepicker.css')
.pipe(rename('bootstrap-datepicker.scss'))
.pipe(gulp.dest(basePaths.temp + 'sass/bootstrap-datepicker/'));
// Bootstrap Ekko Lightbox
gulp.src(basePaths.packages + 'ekko-lightbox/dist/ekko-lightbox.css')
.pipe(rename('ekko-lightbox.scss'))
.pipe(gulp.dest(basePaths.temp + 'sass/ekko-lightbox/'));
// Font Awesome
gulp.src(basePaths.packages + 'font-awesome/scss/*.scss')
.pipe(gulp.dest(basePaths.temp + 'sass/font-awesome/'));
// Mapbox GL
gulp.src(basePaths.packages + 'mapbox-gl/dist/mapbox-gl.css')
.pipe(rename('mapbox-gl.scss'))
.pipe(gulp.dest(basePaths.temp + 'sass/mapbox-gl'));
// Own CSS Assets
gulp.src(basePaths.assets + 'sass/**/*.scss')
.pipe(gulp.dest(basePaths.temp + 'sass/webapp/'));
/********** Fonts **********/
// Google Fonts
gulp.src(basePaths.assets + 'fonts.list')
.pipe(googleWebFonts({
fontsDir: basePaths.target + 'fonts/google-fonts/',
cssDir: basePaths.temp + 'pre-sass/google-fonts/',
cssFilename: 'google-fonts.scss'
}))
.pipe(gulp.dest('./'));
gulp.src(basePaths.temp + 'pre-sass/google-fonts/google-fonts.scss')
.pipe(replace('static', '/static'))
.pipe(gulp.dest(basePaths.temp + 'sass/google-fonts/'));
// Font Awesome Fonts
gulp.src(basePaths.packages + 'font-awesome/fonts/**/*.{ttf,woff,woff2,eof,svg}')
.pipe(gulp.dest(basePaths.target + 'fonts/font-awesome/'));
/********** Images **********/
/********** full copy **********/
});