-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgulpfile.js
113 lines (96 loc) · 3.48 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
113
const { src, dest, series } = require('gulp');
const minifyCSS = require('gulp-clean-css');
const zip = require('gulp-zip');
const clean = require('gulp-clean');
var uglify = require('gulp-uglify-es').default;
// Create a build
function cleanBuild() {
return src('./build', { read: false, allowEmpty: true }).pipe(clean());
}
function cleanZip() {
return src('./com_spsimpleportfolio_v2.1.0.zip', { read: false, allowEmpty: true }).pipe(clean());
}
function copySite() {
return src([
'./components/com_spsimpleportfolio/**/*.*',
'!./components/com_spsimpleportfolio/assets/reactjs/**/*.*',
'!./components/com_spsimpleportfolio/assets/js/engine.js.map',
]).pipe(dest('build/site'));
}
function copyAdmin() {
return src([
'./administrator/components/com_spsimpleportfolio/**/*.*',
'!./administrator/components/com_spsimpleportfolio/assets/reactjs/**/*.*',
'!./administrator/components/com_spsimpleportfolio/installer.script.php',
'!./administrator/components/com_spsimpleportfolio/sppagebuilder.xml',
'!./administrator/components/com_spsimpleportfolio/assets/js/engine.js.map',
]).pipe(dest('build/admin'));
}
function copy_lang_site() {
return src('./language/en-GB/en-GB.com_spsimpleportfolio.ini').pipe(dest('build/language/site/en-GB'));
}
function copy_lang_admin() {
return src([
'./administrator/language/en-GB/en-GB.com_spsimpleportfolio.ini',
'./administrator/language/en-GB/en-GB.com_spsimpleportfolio.sys.ini',
]).pipe(dest('build/language/admin/en-GB'));
}
function copy_modules() {
return src('./modules/mod_spsimpleportfolio/**/*.*').pipe(dest('build/modules/mod_spsimpleportfolio'));
}
function copy_plugins() {
return src('./plugins/finder/spsimpleportfolio/**/*.*').pipe(dest('build/plugins/finder/spsimpleportfolio'));
}
function copy_plugins_lang() {
return src(['./administrator/language/en-GB/plg_finder_spsimpleportfolio.ini',
'./administrator/language/en-GB/plg_finder_spsimpleportfolio.sys.ini',]).pipe(
dest('build/plugins/finder/spsimpleportfolio/language')
);
}
function copy_modules_lang() {
return src('./language/en-GB/en-GB.mod_spsimpleportfolio.ini').pipe(
dest('build/modules/mod_spsimpleportfolio/language')
);
}
function copy_installer() {
return src([
'./administrator/components/com_spsimpleportfolio/installer.script.php',
'./administrator/components/com_spsimpleportfolio/spsimpleportfolio.xml',
]).pipe(dest('build'));
}
function minify_admin_css() {
return src(['./build/admin/assets/css/*.css']).pipe(minifyCSS()).pipe(dest('./build/admin/assets/css/'));
}
function minify_site_css() {
return src(['./build/site/assets/css/*.css']).pipe(minifyCSS()).pipe(dest('./build/site/assets/css/'));
}
function minify_site_js() {
return src([
'./build/site/assets/js/*.js',
'!build/admin/assets/js/featherlight.min.js',
'!build/admin/assets/js/jquery.shuffle.modernizr.min.js',
])
.pipe(uglify())
.pipe(dest('./build/site/assets/js/'));
}
function minify_admin_js() {
return src(['./build/admin/assets/js/*.js']).pipe(uglify()).pipe(dest('./build/admin/assets/js/'));
}
function makeZip() {
return src('./build/**/*.*').pipe(zip('com_spsimpleportfolio_v2.1.0.zip')).pipe(dest('./'));
}
exports.copy = series(
cleanBuild,
cleanZip,
copySite,
copyAdmin,
copy_lang_site,
copy_lang_admin,
copy_modules,
copy_modules_lang,
copy_plugins,
copy_plugins_lang,
copy_installer
);
exports.minify = series(minify_admin_css, minify_site_css, minify_site_js, minify_admin_js);
exports.default = series(exports.copy, exports.minify, makeZip, cleanBuild);