Browse Source

Refactoring config

pull/1785/head
jlukic 9 years ago
parent
commit
6943bfac53
1 changed files with 12 additions and 14 deletions
  1. 26
      tasks/config/user.js

26
tasks/config/user.js

@ -13,8 +13,11 @@ var
defaults = require('./defaults'),
config = require('./project/config'),
// semantic.json settings
userConfig,
// final config object
userConfig
gulpConfig
;
@ -32,28 +35,23 @@ catch(error) {
}
}
if(!userConfig) {
// No semantic.json file use tasks/config/defaults.js
console.error('Using default values for gulp');
userConfig = extend(false, {}, defaults);
}
else {
// extend defaults using shallow copy
userConfig = extend(false, {}, defaults, userConfig);
}
// extend user config with defaults
gulpConfig = (!userConfig)
? extend(false, {}, defaults)
: extend(false, {}, defaults, userConfig)
;
/*******************************
Add Derived Values
*******************************/
// adds additional derived values to config
userConfig = config.addDerivedValues(userConfig);
// adds calculated values
config.addDerivedValues(gulpConfig);
/*******************************
Export
*******************************/
module.exports = userConfig;
module.exports = gulpConfig;
Loading…
Cancel
Save