-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
153 lines (129 loc) · 4.37 KB
/
gulpfile.babel.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
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
'use strict';
import gulp from 'gulp';
import taskList from 'gulp-task-listing';
import {paths} from './gulp/constants.js';
import buildImages from './gulp/build-images.js';
import buildScripts from './gulp/build-scripts.js';
import buildStyles from './gulp/build-styles.js';
import buildWebfonts from './gulp/build-webfonts.js';
import {getSourcePathFromPathObject} from './gulp/utils.js';
// SCRIPTS
const buildScriptsTask = (cb) => {
buildScripts(cb, [
{
distFileName: 'index.js',
distPath: paths.scripts.detail.dist, // folder to save the compiled js file into
sourceFileName: 'index.ts',
sourcePath: paths.scripts.detail.src,
},
{
distFileName: 'administrativeUnitsMap.js',
distPath: paths.scripts.global.dist, // folder to save the compiled js file into
sourceFileName: 'index.ts',
sourcePath: paths.scripts.global.src + '/administrativeUnitsMap',
},
{
distFileName: 'editor.js',
distPath: paths.scripts.global.dist, // folder to save the compiled js file into
sourceFileName: 'editor.js',
sourcePath: paths.scripts.global.src,
},
{
distFileName: 'expandable.js',
distPath: paths.scripts.global.dist, // folder to save the compiled js file into
sourceFileName: 'expandable.ts',
sourcePath: paths.scripts.global.src,
},
{
distFileName: 'lazyLoad.js',
distPath: paths.scripts.global.dist, // folder to save the compiled js file into
sourceFileName: 'lazyLoad.ts',
sourcePath: paths.scripts.global.src,
},
{
distFileName: 'lightbox.js',
distPath: paths.scripts.global.dist, // folder to save the compiled js file into
sourceFileName: 'lightbox.ts',
sourcePath: paths.scripts.global.src,
},
{
distFileName: 'menuHandler.js',
distPath: paths.scripts.global.dist, // folder to save the compiled js file into
sourceFileName: 'menuHandler.ts',
sourcePath: paths.scripts.global.src,
},
{
distFileName: 'references.js',
distPath: paths.scripts.global.dist, // folder to save the compiled js file into
sourceFileName: 'index.ts',
sourcePath: paths.scripts.global.src + '/references',
},
]);
};
gulp.task('build:scripts', gulp.series(buildScriptsTask));
gulp.task('watch:scripts', gulp.series(buildScriptsTask, () => {
gulp.watch(getSourcePathFromPathObject(paths.scripts).map((path) => path + '/**/*.{ts,js}'), gulp.series(buildScriptsTask));
}));
// STYLES
const buildStylesTask = (cb) => {
buildStyles(cb, [
{
distPath: paths.styles.global.dist, // folder to save the compiled css file into
distFileName: 'style.css',
sourceFileName: paths.styles.global.src + '/style.scss', // name of source file
},
{
distPath: paths.styles.global.dist, // folder to save the compiled css file into
distFileName: 'editor.css',
sourceFileName: paths.styles.global.src + '/editor.scss', // name of source file
},
{
distPath: paths.styles.global.dist, // folder to save the compiled css file into
distFileName: 'events.css',
sourceFileName: paths.styles.global.src + '/events.scss', // name of source file
},
]);
};
gulp.task('build:styles', gulp.series(buildStylesTask));
gulp.task('watch:styles', gulp.series(buildStylesTask, () => {
gulp.watch(getSourcePathFromPathObject(paths.styles).map((path) => path + '/**/*.scss'), gulp.series(buildStylesTask));
}));
// WEBFONTS
const buildWebfontsTask = () => {
return buildWebfonts(
{
distPath: paths.webfonts.global.dist,
sourcePath: paths.webfonts.global.src,
},
);
};
gulp.task('build:webfonts', gulp.series(buildWebfontsTask));
gulp.task('watch:webfonts', gulp.series(buildWebfontsTask, () => {
gulp.watch(getSourcePathFromPathObject(paths.webfonts).map((path) => path + '/*'), gulp.series(buildWebfontsTask));
}));
// IMAGES
const buildImagesTask = (cb) => {
return buildImages(cb, [
paths.images.global,
// paths.images.rentals,
]);
};
gulp.task('build:images', gulp.series(buildImagesTask));
gulp.task('watch:images', gulp.series(buildImagesTask, () => {
gulp.watch(getSourcePathFromPathObject(paths.images).map((path) => path + '/**/*.{gif,ico,jpg,jpeg,png,svg}'), gulp.series(buildImagesTask)); // @todo: add custom
}));
// HELPERS
gulp.task('help', taskList);
gulp.task('watch', gulp.parallel(
'watch:scripts',
'watch:styles',
'watch:webfonts',
'watch:images',
));
gulp.task('build', gulp.parallel(
'build:scripts',
'build:styles',
'build:webfonts',
'build:images',
));
gulp.task('default', gulp.series('build'));