1
|
|
|
const gulp = require('gulp'); |
2
|
|
|
const tailwindConfig = "tailwind.config.js"; |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* Task: gulp vendor-css |
6
|
|
|
*/ |
7
|
|
|
gulp.task("vendor-css", function() { |
8
|
|
|
const concat = require('gulp-concat'); |
9
|
|
|
const csso = require('gulp-csso'); |
10
|
|
|
const autoprefixer = require('gulp-autoprefixer'); |
11
|
|
|
|
12
|
|
|
return gulp |
13
|
|
|
.src([ |
14
|
|
|
// Swal2 |
15
|
|
|
'node_modules/sweetalert2/dist/sweetalert2.min.css', |
16
|
|
|
|
17
|
|
|
// AnimateCSS |
18
|
|
|
'node_modules/animate.css/animate.min.css', |
19
|
|
|
|
20
|
|
|
// CodeMirror |
21
|
|
|
'node_modules/codemirror/lib/codemirror.css', |
22
|
|
|
'node_modules/codemirror/theme/elegant.css']) |
23
|
|
|
.pipe(autoprefixer({ |
24
|
|
|
overrideBrowserslist: [ |
25
|
|
|
"last 1 version" |
26
|
|
|
], |
27
|
|
|
cascade: false |
28
|
|
|
})) |
29
|
|
|
.pipe(csso()) |
30
|
|
|
.pipe(concat('admin-vendor-build.min.css')) |
31
|
|
|
.pipe(gulp.dest("assets/dist/css/")); |
32
|
|
|
}); |
33
|
|
|
|
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Task: gulp admin-css |
37
|
|
|
*/ |
38
|
|
|
gulp.task("admin-css", function() { |
39
|
|
|
const atimport = require("postcss-import"); |
40
|
|
|
const postcss = require("gulp-postcss"); |
41
|
|
|
const tailwindcss = require("tailwindcss"); |
42
|
|
|
const purgecss = require("gulp-purgecss"); |
43
|
|
|
const concat = require('gulp-concat'); |
44
|
|
|
const csso = require('gulp-csso'); |
45
|
|
|
const sourcemaps = require('gulp-sourcemaps'); |
|
|
|
|
46
|
|
|
const autoprefixer = require('gulp-autoprefixer'); |
47
|
|
|
|
48
|
|
|
return gulp |
49
|
|
|
.src(['assets/src/admin-panel.css']) |
50
|
|
|
.pipe(postcss([atimport(), tailwindcss(tailwindConfig)])) |
51
|
|
|
.pipe( |
52
|
|
|
purgecss({ |
53
|
|
|
content: ["templates/**/*.html"], |
54
|
|
|
extractors: [ |
55
|
|
|
{ |
56
|
|
|
extractor: TailwindExtractor = (content) => { |
|
|
|
|
57
|
|
|
return content.match(/[\w-/:]+(?<!:)/g) || []; |
|
|
|
|
58
|
|
|
}, |
59
|
|
|
extensions: ["html"] |
60
|
|
|
} |
61
|
|
|
] |
62
|
|
|
}) |
63
|
|
|
) |
64
|
|
|
.pipe(autoprefixer({ |
65
|
|
|
overrideBrowserslist: [ |
66
|
|
|
"last 1 version" |
67
|
|
|
], |
68
|
|
|
cascade: false |
69
|
|
|
})) |
70
|
|
|
.pipe(csso()) |
71
|
|
|
.pipe(concat('admin-build.min.css')) |
72
|
|
|
.pipe(gulp.dest("assets/dist/css/")); |
73
|
|
|
}); |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Task: gulp vendor-js |
77
|
|
|
*/ |
78
|
|
|
gulp.task('vendor-js', function(){ |
79
|
|
|
const sourcemaps = require('gulp-sourcemaps'); |
80
|
|
|
const concat = require('gulp-concat'); |
81
|
|
|
|
82
|
|
|
return gulp.src([ |
83
|
|
|
// Swal2 |
84
|
|
|
'node_modules/sweetalert2/dist/sweetalert2.min.js', |
85
|
|
|
|
86
|
|
|
// ParsleyJS Form Validatator |
87
|
|
|
'node_modules/parsleyjs/dist/parsley.min.js', |
88
|
|
|
|
89
|
|
|
// SpeakingURL |
90
|
|
|
'node_modules/speakingurl/speakingurl.min.js', |
91
|
|
|
|
92
|
|
|
// Popper |
93
|
|
|
'node_modules/popper.js/dist/umd/popper.min.js', |
94
|
|
|
|
95
|
|
|
// Tippy |
96
|
|
|
'node_modules/tippy.js/dist/tippy-bundle.iife.min.js', |
97
|
|
|
|
98
|
|
|
// Clipboard |
99
|
|
|
'node_modules/clipboard/dist/clipboard.min.js', |
100
|
|
|
|
101
|
|
|
// CodeMirror |
102
|
|
|
'node_modules/codemirror/lib/codemirror.js', |
103
|
|
|
'node_modules/codemirror/mode/htmlmixed/htmlmixed.js', |
104
|
|
|
'node_modules/codemirror/mode/xml/xml.js', |
105
|
|
|
'node_modules/codemirror/mode/javascript/javascript.js', |
106
|
|
|
'node_modules/codemirror/mode/php/php.js', |
107
|
|
|
'node_modules/codemirror/mode/clike/clike.js', |
108
|
|
|
'node_modules/codemirror/mode/yaml/yaml.js' |
109
|
|
|
]) |
110
|
|
|
.pipe(sourcemaps.init()) |
111
|
|
|
.pipe(concat('admin-vendor-build.min.js')) |
112
|
|
|
.pipe(sourcemaps.write()) |
113
|
|
|
.pipe(gulp.dest('assets/dist/js/')); |
114
|
|
|
}); |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Task: gulp default |
118
|
|
|
*/ |
119
|
|
|
gulp.task('default', gulp.series( |
120
|
|
|
'vendor-css', 'admin-css', 'vendor-js' |
121
|
|
|
)); |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Task: gulp watch |
125
|
|
|
*/ |
126
|
|
|
gulp.task('watch', function () { |
127
|
|
|
gulp.watch(["templates/**/*.html", "assets/src/"], gulp.series('vendor-css', 'admin-css')); |
128
|
|
|
}); |
129
|
|
|
|