-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.js
44 lines (36 loc) · 1.22 KB
/
index.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
/**
gulp-build-fozzie
===========
Rather than manage one giant configuration file responsible
for creating multiple tasks, each task has been broken out into
its own file in `tasks`. Any files in that directory get
automatically required below.
To add a new task, simply add a new task file that directory.
`tasks/default.js` specifies the default set of tasks to run
when you run `gulp`.
*/
const requireDir = require('require-dir');
const gulp = require('gulp');
const config = require('./config');
const pathBuilder = require('./pathBuilder');
const build = (srcGulp, options) => {
if (options) {
// Update config & pathBuilder with custom values — these values will
// persist across all further requires in other files.
config.update(options);
pathBuilder.update(config);
}
// Assign existing gulp tasks so that they are not lost.
gulp.tasks = srcGulp.tasks;
// Require all tasks in /tasks, including subfolders
requireDir('./tasks', { recurse: true });
// Require dev tasks if running in development.
if (config.isDev) {
requireDir('./tasks-dev', { recurse: false });
}
};
module.exports = {
build,
config,
pathBuilder
};