-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
35 lines (31 loc) · 1.07 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
var path = require( 'path' ),
gulp = require( 'gulp' ),
loadPlugins = require( 'gulp-load-plugins' ),
includeAll = require( 'include-all' );
var plugins = loadPlugins( {
pattern: [ 'gulp-*', 'merge-*', 'run-*', 'main-*' ], // the glob to search for
replaceString: /\bgulp[\-.]|run[\-.]|merge[\-.]|main[\-.]/, // remove from the name of the module when adding it to the context
camelizePluginName: true,
lazy: true // lazy-load plugins on demand
} );
/**
* Loads Gulp configuration modules from the specified
* relative path. These modules should export a function
* that, when run, should either load/configure or register
* a Gulp task.
*/
var loadTasks = function( relPath ) {
return includeAll( {
dirname: path.resolve( __dirname, relPath ),
filter: /(.+)\.js$/
} ) || {};
};
var setupTasks = function( tasks ) {
for( var taskName in tasks ) {
if( tasks.hasOwnProperty( taskName ) ) {
tasks[ taskName ]( gulp, plugins, path );
}
}
};
var tasks = loadTasks( './tasks' );
setupTasks( tasks );