-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulp-get-ext.js
34 lines (28 loc) · 1023 Bytes
/
gulp-get-ext.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
var _ = require('lodash');
module.exports = {
applyTo: function (gulp) {
var extOptions;
if (!gulp.getExt) {
extOptions = _.get(gulp, 'webToolsConfig.extOptions');
gulp.getExt = function getExtFiles(options) {
if (_.isFunction(extOptions.getter)) {
return extOptions.getter(options);
} else if (extOptions.getter === 'npm') {
return require('main-npm-files')('**/*.*', _.defaultsDeep({
pkgJson: _.get(extOptions, 'json', 'package.json'),
nodeModules: _.get(extOptions, 'modules', 'node_modules'),
onlyMain: false
}, options));
} else {
return require('main-bower-files')(_.defaultsDeep({
paths: {
bowerJson: _.get(extOptions, 'json', 'bower.json'),
bowerDirectory: _.get(extOptions, 'modules', 'bower_components')
}
}, options));
}
};
}
return gulp;
}
};