-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgulpfile.js
More file actions
156 lines (127 loc) · 3.29 KB
/
gulpfile.js
File metadata and controls
156 lines (127 loc) · 3.29 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/**
* Load Modules
* ================================================================================
*/
import gulp from 'gulp';
/**
* Load Tasks
*/
// Styles
import { scss, cssCompress, stylesReload } from './.gulp/styles.js';
// JavaScript
import { roll, scriptsReload, compressJS, jsConcatVendorLibs } from './.gulp/javascript.js';
// HTML
import { htmlGenerate, htmlReload, htmlCompress, validateHtml, testHtml, htmlPagesPreview } from './.gulp/html.js';
// Images
import { webpCompress, copyImages } from './.gulp/images.js';
import getSprite from './.gulp/sprite.js';
// Server
import { openServer, openBrowser, bumper, cleanBuild, cleanDist, cleanHTML, openProxyTunnel, bs } from './.gulp/server.js';
// Misc
import { copyTest, copyFiles, copyBuildFiles, copyVideo, copyFonts, copyIcons, copyReport } from './.gulp/misc.js';
// Tests
import { mobileTestRes, htmlSpeedRes, cssTestRes } from './.gulp/tests.js';
/**
* @todo Tasks
* @todo Statistics
*/
/**
* System
*/
const { parallel, series, watch } = gulp;
/**
* Start
*/
// Disable deprecation warnings
process.noDeprecation = true;
// Increase event listener limit
process.setMaxListeners(0);
// Clear shell screen
console.clear();
/**
* Settings
* ================================================================================
*/
/**
* JS Libraries List
*/
const jsVendorList = {
src: [
// './node_modules/jquery/dist/jquery.min.js',
'./dist/javascript/app.js'
]
};
const concatJsLibs = (done) => jsConcatVendorLibs(jsVendorList, done);
/**
* Tasks
* ================================================================================
*/
/**
* Watcher
*/
const cfgWatch = {
usePolling: true,
interval: 500,
ignoreInitial: true
};
const watcher = (done) => {
watch('./src/scss/**/*.scss', cfgWatch, series(scss, stylesReload));
watch('./src/**/*.html', cfgWatch, series(htmlGenerate, cleanHTML, htmlReload, testHtml));
watch('./src/javascript/**/*.js', cfgWatch, series(series(roll, concatJsLibs), scriptsReload));
watch('./src/images/**/*', cfgWatch, series(webpCompress, copyImages));
watch('./src/favicons/**/*', cfgWatch, series(copyIcons));
watch('./src/fonts/**/*', cfgWatch, series(copyFonts));
watch('./src/video/**/*', cfgWatch, series(copyVideo));
watch('./src/test/**/*', cfgWatch, series(copyTest));
watch('./src/report/**/*', cfgWatch, series(copyReport));
done();
};
/**
* Default Tasks
*/
export default series(
cleanDist,
cleanBuild,
copyFiles,
copyVideo,
copyFonts,
copyIcons,
copyTest,
parallel(
series(series(roll, concatJsLibs)),
series(scss),
series(webpCompress, copyImages),
series(htmlGenerate, cleanHTML, openBrowser, htmlPagesPreview),
openServer,
openProxyTunnel,
watcher
)
);
/**
* Test Tasks
*/
const test = parallel(mobileTestRes, htmlSpeedRes, cssTestRes, validateHtml);
/**
* Build Tasks
*/
const build = series(
cleanDist,
cleanBuild,
copyBuildFiles,
parallel(
series(series(roll, concatJsLibs, compressJS)),
series(scss, cssCompress),
series(webpCompress, copyImages),
series(htmlGenerate, cleanHTML, htmlCompress)
),
bumper
);
/**
* Generate Images
*/
const images = series(webpCompress, copyImages);
/**
* Generate SVG Sprite
*/
const sprite = series(getSprite);
export { test, build, images, sprite };