-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
104 lines (92 loc) · 3.91 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
const gulp = require('gulp');
const gulpIf = require('gulp-if');
const debug = require('gulp-debug');
const del = require('del');
const eventStream = require('event-stream');
const config = require('./config');
const paths = {
sep: '/',
root: './',
nodeModules: './node_modules',
dist: {
dir: './dist',
vendor: {
dir: './dist/vendor',
fa: './dist/vendor/fontawesome',
bs: './dist/vendor/bootstrap',
jq: './dist/vendor/jquery',
pjs: './dist/vendor/parsleyjs',
dtb: './dist/vendor/dataTables',
mmt: './dist/vendor/momentjs',
prjs: './dist/vendor/prismjs'
}
}
};
const tasks = {
default: 'default',
copy: 'copy',
del: 'del'
};
gulp.task(tasks.default, [tasks.del, tasks.copy]);
gulp.task(tasks.copy, () => {
return eventStream.merge([
// Font Awesome
gulp.src(`${paths.nodeModules}/@fortawesome/fontawesome-free/js/*.js`)
.pipe(debug({ title: "--- copied FontAwesome 5 Free scripts" }))
.pipe(gulp.dest(`${paths.dist.vendor.fa}/js`)),
gulp.src(`${paths.nodeModules}/@fortawesome/fontawesome-free/svgs/**/*.svg`)
.pipe(debug({ title: "--- copied FontAwesome 5 Free SVGs" }))
.pipe(gulp.dest(`${paths.dist.vendor.fa}/svgs`)),
//Bootstrap
gulp.src([
`${paths.nodeModules}/bootstrap/dist/css/bootstrap.css`,
`${paths.nodeModules}/bootstrap/dist/css/bootstrap.css.map`,
`${paths.nodeModules}/bootstrap/dist/css/bootstrap.min.css`,
`${paths.nodeModules}/bootstrap/dist/css/bootstrap.min.css.map`
])
.pipe(debug({ title: "--- copied Bootstrap 4 styles" }))
.pipe(gulp.dest(`${paths.dist.vendor.bs}/css`)),
gulp.src([
`${paths.nodeModules}/bootstrap/dist/js/bootstrap.bundle.js`,
`${paths.nodeModules}/bootstrap/dist/js/bootstrap.bundle.js.map`,
`${paths.nodeModules}/bootstrap/dist/js/bootstrap.bundle.min.js`,
`${paths.nodeModules}/bootstrap/dist/js/bootstrap.bundle.min.js.map`
])
.pipe(debug({ title: "--- copied Bootstrap 4 bundle scripts" }))
.pipe(gulp.dest(`${paths.dist.vendor.bs}/js`)),
//jQuery
gulp.src(`${paths.nodeModules}/jquery/dist/**.*`)
.pipe(debug({ title: "--- copied jQuery scripts" }))
.pipe(gulp.dest(paths.dist.vendor.jq)),
//Parsley
gulp.src([
`${paths.nodeModules}/parsleyjs/src/parsley.css`,
`${paths.nodeModules}/parsleyjs/dist/**.*`
])
.pipe(gulpIf(config.parsley, gulp.dest(`${paths.dist.vendor.pjs}`))),
//DataTables
gulp.src([
`${paths.nodeModules}/dataTables.net-bs4/css/**.*`,
`${paths.nodeModules}/dataTables.net-responsive-bs4/css/**.*`
])
.pipe(gulpIf(config.dataTables, gulp.dest(`${paths.dist.vendor.dtb}/css`))),
gulp.src([
`${paths.nodeModules}/dataTables.net/js/**.*`,
`${paths.nodeModules}/dataTables.net-responsive/js/**.*`,
`${paths.nodeModules}/dataTables.net-bs4/js/**.*`,
`${paths.nodeModules}/dataTables.net-responsive-bs4/js/**.*`
])
.pipe(gulpIf(config.dataTables, gulp.dest(`${paths.dist.vendor.dtb}/js`))),
//Moment
gulp.src(`${paths.nodeModules}/moment/min/**.*`)
.pipe(gulpIf(config.datetimePicker, gulp.dest(`${paths.dist.vendor.mmt}`))),
//PrismJS
gulp.src(`${paths.nodeModules}/prismjs/**/*.{css,js}`)
.pipe(gulpIf(config.prism, gulp.dest(`${paths.dist.vendor.prjs}`)))
]);
});
gulp.task(tasks.del, () => {
return del.sync([
`${paths.dist.vendor.dir}/**/*.*`
]);
});