forked from facultyai/dash-bootstrap-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
75 lines (67 loc) · 1.72 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
const {dest, parallel, series, src} = require('gulp');
const del = require('del');
const mkdirp = require('mkdirp');
const rename = require('gulp-rename');
const footer = require('gulp-footer');
function cleanLib() {
mkdirp.sync('lib');
return del(['lib/*']);
}
function cleanDist() {
mkdirp.sync('dist');
return del(['dist/*']);
}
function copyDist() {
return src(
'dash_bootstrap_components/_components/dash_bootstrap_components.min.js'
).pipe(dest('dist/'));
}
function cleanComponents() {
return del(['dash_bootstrap_components/_components/*']);
}
function cleanGeneratedFiles() {
return del([
'dash_bootstrap_components/*.(py|json)',
'!dash_bootstrap_components/(__init__|_table|_version|themes).py'
]);
}
function copyGeneratedFiles() {
return src('dash_bootstrap_components/*', {
ignore: ['__init__.py', '_table.py', '_version.py', 'themes.py'].map(
function prepend(stub) {
return 'dash_bootstrap_components/' + stub;
}
)
})
.pipe(
rename(function(path) {
if (path.basename === '_imports_') {
return {
basename: '__init__',
extname: path.extname,
dirname: path.dirname
};
}
return path;
})
)
.pipe(dest('dash_bootstrap_components/_components'));
}
function addThemesToRNamespace() {
return src('NAMESPACE')
.pipe(footer('export(dbcThemes)'))
.pipe(dest('.', {overwrite: true}));
}
exports.postPyBuild = series(copyDist, copyGeneratedFiles, cleanGeneratedFiles);
exports.clean = parallel(
cleanGeneratedFiles,
cleanComponents,
cleanLib,
cleanDist
);
exports.postRBuild = series(
copyDist,
copyGeneratedFiles,
cleanGeneratedFiles,
addThemesToRNamespace
);