-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
80 lines (74 loc) · 1.92 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
const {
src, dest, parallel, series,
} = require('gulp');
const rename = require('gulp-rename');
const concat = require('gulp-concat');
const csso = require('gulp-csso');
const copy = require('gulp-copy');
const htmlcpr = require('gulp-htmlcpr');
function bundleCss() {
return src(['./src/css/default.css', './src/css/jquery-ui.theme.min.css'])
.pipe(concat('map2gpx.css'))
.pipe(dest('./dist-www/css'))
.pipe(csso())
.pipe(rename('map2gpx.min.css'))
.pipe(dest('./dist-www/css'));
}
function bundleImages() {
return src(['./src/css/images/*']).pipe(copy('./dist-www/css/images', { prefix: 3 }));
}
const htmlcprConfig = {
blacklistFn: (url) => {
if (url.startsWith('%')) {
return true;
}
return false;
},
skipFn: (url) => {
if (url === '#default#VML') {
return true;
}
return false;
},
};
function copyDependenciesFrMain() {
return src('index-fr.html')
.pipe(rename('index.html'))
.pipe(htmlcpr(htmlcprConfig))
.pipe(dest('./www-fr/'));
}
function copyDependenciesFrOsm() {
return src('index-fr-osm.html')
.pipe(rename('osm.html'))
.pipe(htmlcpr(htmlcprConfig))
.pipe(dest('./www-fr/'));
}
function copyDependenciesEn() {
return src('index-en.html')
.pipe(rename('index.html'))
.pipe(htmlcpr(htmlcprConfig))
.pipe(dest('./www-en/'));
}
function copyAssetsCommon() {
return src(['map2gpx.png', './screenshot.png', './fetch.php'])
.pipe(dest('./www-fr/'))
.pipe(dest('./www-en/'));
}
function copyAssetsIgn() {
return src(['./slope.php']).pipe(dest('./www-fr/'));
}
function copyConfIgn() {
return src(`./autoconf.json`, { allowEmpty: true })
.pipe(rename('autoconf.json'))
.pipe(dest('./www-fr/'));
}
exports.pack = series(
parallel(bundleCss, bundleImages),
parallel(
series(copyDependenciesFrMain, copyDependenciesFrOsm),
copyDependenciesEn,
copyAssetsCommon,
copyAssetsIgn,
copyConfIgn,
),
);