This repository has been archived by the owner on Mar 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
gulpfile.babel.js
60 lines (51 loc) · 1.74 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
import chug from 'gulp-chug';
import gulp from 'gulp';
import yargs from 'yargs';
const { argv } = yargs
.options({
rootPath: {
description: '<path> path to public assets directory',
type: 'string',
requiresArg: true,
required: false,
},
nodeModulesPath: {
description: '<path> path to node_modules directory',
type: 'string',
requiresArg: true,
required: false,
},
});
const config = [
'--rootPath',
argv.rootPath || '../../public/assets',
'--nodeModulesPath',
argv.nodeModulesPath || '../../node_modules',
];
export const buildAdmin = function buildAdmin() {
return gulp.src('assets/backend/gulpfile.babel.js', { read: false })
.pipe(chug({ args: config, tasks: 'build' }));
};
buildAdmin.description = 'Build admin assets.';
export const watchAdmin = function watchAdmin() {
return gulp.src('assets/backend/gulpfile.babel.js', { read: false })
.pipe(chug({ args: config, tasks: 'watch' }));
};
watchAdmin.description = 'Watch admin asset sources and rebuild on changes.';
export const buildApp = function buildApp() {
return gulp.src('assets/frontend/gulpfile.babel.js', { read: false })
.pipe(chug({ args: config, tasks: 'build' }));
};
buildApp.description = 'Build app assets.';
export const watchApp = function watchApp() {
return gulp.src('assets/frontend/gulpfile.babel.js', { read: false })
.pipe(chug({ args: config, tasks: 'watch' }));
};
watchApp.description = 'Watch app asset sources and rebuild on changes.';
export const build = gulp.parallel(buildAdmin, buildApp);
build.description = 'Build assets.';
gulp.task('admin', buildAdmin);
gulp.task('admin-watch', watchAdmin);
gulp.task('app', buildApp);
gulp.task('app-watch', watchApp);
export default build;