| Total Complexity | 5 |
| Complexity/F | 1 |
| Lines of Code | 64 |
| Function Count | 5 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | // Gulp.js configuration |
||
| 4 | const { src, dest, series } = require('gulp'); |
||
| 5 | const concat = require('gulp-concat'); |
||
| 6 | // const deporder = require('gulp-deporder'); |
||
| 7 | const rename = require('gulp-rename'); |
||
| 8 | // const stripdebug = require('gulp-strip-debug'); |
||
| 9 | const terser = require('gulp-terser'); |
||
| 10 | |||
| 11 | // Folders and files |
||
| 12 | const folders = { |
||
| 13 | src: './js/', |
||
| 14 | dist: './dist/', |
||
| 15 | }; |
||
| 16 | const files = { |
||
| 17 | src: { |
||
| 18 | libs: [ |
||
| 19 | 'alertify', |
||
| 20 | 'bootbox', |
||
| 21 | 'bootstrap3', |
||
| 22 | 'bootstrap4', |
||
| 23 | 'bootstrap5', |
||
| 24 | 'cute', |
||
| 25 | 'jalert', |
||
| 26 | 'jconfirm', |
||
| 27 | 'notify', |
||
| 28 | 'noty', |
||
| 29 | 'notyf', |
||
| 30 | 'sweetalert', |
||
| 31 | 'tingle', |
||
| 32 | 'toastr', |
||
| 33 | 'butterup', |
||
| 34 | 'quantum', |
||
| 35 | 'izitoast', |
||
| 36 | ], |
||
| 37 | }, |
||
| 38 | dist: { |
||
| 39 | all: 'dialogs.all.js', |
||
| 40 | }, |
||
| 41 | min: { |
||
| 42 | all: 'dialogs.all.min.js', |
||
| 43 | }, |
||
| 44 | }; |
||
| 45 | |||
| 46 | // Concat each library js file |
||
| 47 | const js_libs_min = () => src(files.src.libs.map((file) => folders.src + file + '.js')) |
||
| 48 | // .pipe(stripdebug()) |
||
| 49 | .pipe(terser()) |
||
| 50 | .pipe(rename({ extname: '.min.js' })) |
||
| 51 | .pipe(dest(folders.src)); |
||
| 52 | |||
| 53 | // Concat all the js files |
||
| 54 | const js_all = () => src(files.src.libs.map((file) => folders.src + file + '.js')) |
||
| 55 | // .pipe(deporder()) |
||
| 56 | .pipe(concat(files.dist.all, {newLine: "\n\n"})) |
||
| 57 | .pipe(dest(folders.dist)); |
||
| 58 | |||
| 59 | // Minify the resulting file |
||
| 60 | const js_all_min = () => src(folders.dist + files.dist.all) |
||
| 61 | // .pipe(stripdebug()) |
||
| 62 | .pipe(terser()) |
||
| 63 | .pipe(rename({ extname: '.min.js' })) |
||
| 64 | .pipe(dest(folders.dist)); |
||
| 65 | |||
| 66 | exports.default = series(js_libs_min, js_all, js_all_min); |
||
| 67 | exports.js_all = js_all; |
||
| 68 |