forked from eXist-db/function-documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
112 lines (99 loc) · 2.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
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
/**
* an example gulpfile to make ant-less existdb package builds a reality
*/
const { src, dest, series, parallel } = require("gulp");
const del = require("delete");
// const gulpEsbuild = require("gulp-esbuild");
const paths = {
input: "src/main/xar-resources/resources",
output: "target/generated-resources/frontend/xar-resources/resources/",
images: {
input: "src/main/xar-resources/resources/img/*",
output: "target/generated-resources/frontend/xar-resources/resources/img/",
},
scripts: {
input: "src/main/xar-resources/resources/scripts/*",
output:
"target/generated-resources/frontend/xar-resources/resources/scripts/",
},
styles: {
input: "src/main/xar-resources/resources/css/*",
output: "target/generated-resources/frontend/xar-resources/resources/css/",
},
fonts: {
input: "src/main/xar-resources/resources/fonts/*",
output:
"target/generated-resources/frontend/xar-resources/resources/fonts/",
},
vendor: {
scripts: [
"src/main/xar-resources/resources/vendor/scripts/*",
"node_modules/bootstrap/dist/js/bootstrap.min.*",
"node_modules/jquery/dist/jquery.min.*",
"node_modules/prismjs/prism.js",
"node_modules/prismjs/components/prism-xquery.min.js",
"node_modules/prismjs/components/prism-java.min.js",
"node_modules/marked/lib/marked.js"
],
styles: [
"src/main/xar-resources/resources/vendor/styles/*",
"node_modules/bootstrap/dist/css/bootstrap.min.*",
// 'node_modules/prismjs/themes/*.css'
],
fonts: ["node_modules/bootstrap/dist/fonts/*"],
},
};
/**
* Use the `delete` module directly, instead of using gulp-rimraf
*/
function clean(cb) {
del(paths.output, cb);
}
exports.clean = clean;
function styles() {
return src(paths.styles.input).pipe(dest(paths.styles.output));
}
exports.styles = styles;
/**
* minify EcmaSript files and put them into 'build/app/js'
*/
function minifyEs() {
return (
src(paths.scripts.input)
// .pipe(gulpEsbuild())
.pipe(dest(paths.scripts.output))
);
}
exports.minify = minifyEs;
// copy fonts
function copyFonts() {
return src(paths.fonts.input).pipe(
dest(paths.fonts.output)
);
}
// copy vendor scripts
function copyVendorScripts() {
return src(paths.vendor.scripts).pipe(dest(paths.scripts.output));
}
// copy vendor Styles
function copyVendorStyles() {
return src(paths.vendor.styles).pipe(dest(paths.styles.output));
}
// copy vendor fonts
function copyVendorFonts() {
return src(paths.vendor.fonts).pipe(
dest(paths.fonts.output)
);
}
/**
* copy vendor scripts, styles and fonts
*/
const copyStatic = parallel(copyFonts, copyVendorFonts, copyVendorScripts, copyVendorStyles);
// exports.copy = copyStatic;
// ///////////////// //
// composed tasks //
// ///////////////// //
const build = series(clean, styles, minifyEs, copyStatic);
exports.build = build;
// main task for day to day development
exports.default = build;