Added helper function for getting JS assets
This commit is contained in:
parent
2fb96dd68c
commit
0944541247
|
@ -73,17 +73,34 @@ module.exports.getBowerOtherAssets = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* Get the modules JavaScript files
|
||||
* Helper Function for getJavascriptAssets and getFormJavaScriptAssets
|
||||
*/
|
||||
module.exports.getJavaScriptAssets = function(includeTests) {
|
||||
var output = this.getGlobbedFiles(this.assets.js, 'public/', 'static/');
|
||||
var getAssets = function(includeTests, isFormJS){
|
||||
var unit_tests, js_assets;
|
||||
|
||||
if(isFormJS) {
|
||||
js_assets = this.assets.form_js;
|
||||
unit_tests = this.assets.form_unit_tests;
|
||||
} else {
|
||||
js_assets = this.assets.js;
|
||||
unit_tests = this.assets.unit_tests;
|
||||
}
|
||||
|
||||
var output = this.getGlobbedFiles(js_assets, 'public/', 'static/');
|
||||
|
||||
// To include tests
|
||||
if (includeTests) {
|
||||
output = _.union(output, this.getGlobbedFiles(this.assets.unit_tests));
|
||||
output = _.union(output, this.getGlobbedFiles(unit_tests));
|
||||
}
|
||||
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the modules JavaScript files
|
||||
*/
|
||||
module.exports.getJavaScriptAssets = function(includeTests) {
|
||||
return getAssets(includeTests, false);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -98,12 +115,5 @@ module.exports.getCSSAssets = function() {
|
|||
* Get the modules Form JavaScript files
|
||||
*/
|
||||
module.exports.getFormJavaScriptAssets = function(includeTests) {
|
||||
var output = this.getGlobbedFiles(this.assets.form_js, 'public/', 'static/');
|
||||
|
||||
// To include tests
|
||||
if (includeTests) {
|
||||
output = _.union(output, this.getGlobbedFiles(this.assets.form_unit_tests));
|
||||
}
|
||||
|
||||
return output;
|
||||
return getAssets(includeTests, true);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue