|
| 1 | +/** |
| 2 | + * an example gulpfile to make ant-less existdb package builds a reality |
| 3 | + */ |
| 4 | +const { src, dest, series, parallel } = require("gulp"); |
| 5 | +const del = require("delete"); |
| 6 | +// const gulpEsbuild = require("gulp-esbuild"); |
| 7 | + |
| 8 | +const paths = { |
| 9 | + input: "src/main/xar-resources/resources", |
| 10 | + output: "target/generated-resources/frontend/xar-resources/resources/", |
| 11 | + images: { |
| 12 | + input: "src/main/xar-resources/resources/img/*", |
| 13 | + output: "target/generated-resources/frontend/xar-resources/resources/img/", |
| 14 | + }, |
| 15 | + scripts: { |
| 16 | + input: "src/main/xar-resources/resources/scripts/*", |
| 17 | + output: |
| 18 | + "target/generated-resources/frontend/xar-resources/resources/scripts/", |
| 19 | + }, |
| 20 | + styles: { |
| 21 | + input: "src/main/xar-resources/resources/css/*", |
| 22 | + output: "target/generated-resources/frontend/xar-resources/resources/css/", |
| 23 | + }, |
| 24 | + fonts: { |
| 25 | + input: "src/main/xar-resources/resources/fonts/*", |
| 26 | + output: |
| 27 | + "target/generated-resources/frontend/xar-resources/resources/fonts/", |
| 28 | + }, |
| 29 | + vendor: { |
| 30 | + scripts: [ |
| 31 | + "src/main/xar-resources/resources/vendor/scripts/*", |
| 32 | + "node_modules/bootstrap/dist/js/bootstrap.min.*", |
| 33 | + "node_modules/jquery/dist/jquery.min.*", |
| 34 | + "node_modules/prismjs/prism.js", |
| 35 | + "node_modules/prismjs/components/prism-xquery.min.js", |
| 36 | + "node_modules/prismjs/components/prism-java.min.js", |
| 37 | + "node_modules/marked/lib/marked.js" |
| 38 | + ], |
| 39 | + styles: [ |
| 40 | + "src/main/xar-resources/resources/vendor/styles/*", |
| 41 | + "node_modules/bootstrap/dist/css/bootstrap.min.*", |
| 42 | + // 'node_modules/prismjs/themes/*.css' |
| 43 | + ], |
| 44 | + fonts: ["node_modules/bootstrap/dist/fonts/*"], |
| 45 | + }, |
| 46 | +}; |
| 47 | + |
| 48 | +/** |
| 49 | + * Use the `delete` module directly, instead of using gulp-rimraf |
| 50 | + */ |
| 51 | +function clean(cb) { |
| 52 | + del(paths.output, cb); |
| 53 | +} |
| 54 | +exports.clean = clean; |
| 55 | + |
| 56 | +function styles() { |
| 57 | + return src(paths.styles.input).pipe(dest(paths.styles.output)); |
| 58 | +} |
| 59 | +exports.styles = styles; |
| 60 | + |
| 61 | +/** |
| 62 | + * minify EcmaSript files and put them into 'build/app/js' |
| 63 | + */ |
| 64 | +function minifyEs() { |
| 65 | + return ( |
| 66 | + src(paths.scripts.input) |
| 67 | + // .pipe(gulpEsbuild()) |
| 68 | + .pipe(dest(paths.scripts.output)) |
| 69 | + ); |
| 70 | +} |
| 71 | +exports.minify = minifyEs; |
| 72 | + |
| 73 | +// copy fonts |
| 74 | +function copyFonts() { |
| 75 | + return src(paths.fonts.input).pipe( |
| 76 | + dest(paths.fonts.output) |
| 77 | + ); |
| 78 | +} |
| 79 | + |
| 80 | +// copy vendor scripts |
| 81 | +function copyVendorScripts() { |
| 82 | + return src(paths.vendor.scripts).pipe(dest(paths.scripts.output)); |
| 83 | +} |
| 84 | + |
| 85 | +// copy vendor Styles |
| 86 | +function copyVendorStyles() { |
| 87 | + return src(paths.vendor.styles).pipe(dest(paths.styles.output)); |
| 88 | +} |
| 89 | + |
| 90 | +// copy vendor fonts |
| 91 | +function copyVendorFonts() { |
| 92 | + return src(paths.vendor.fonts).pipe( |
| 93 | + dest(paths.fonts.output) |
| 94 | + ); |
| 95 | +} |
| 96 | + |
| 97 | +/** |
| 98 | + * copy vendor scripts, styles and fonts |
| 99 | + */ |
| 100 | +const copyStatic = parallel(copyFonts, copyVendorFonts, copyVendorScripts, copyVendorStyles); |
| 101 | +// exports.copy = copyStatic; |
| 102 | + |
| 103 | +// ///////////////// // |
| 104 | +// composed tasks // |
| 105 | +// ///////////////// // |
| 106 | + |
| 107 | +const build = series(clean, styles, minifyEs, copyStatic); |
| 108 | + |
| 109 | +exports.build = build; |
| 110 | + |
| 111 | +// main task for day to day development |
| 112 | +exports.default = build; |
0 commit comments