Allow single conf objects too

This commit is contained in:
Dan Mindru 2016-08-19 22:47:53 +02:00
parent 1bdbed78c9
commit e5cd2fd649
2 changed files with 12 additions and 14 deletions

View File

@ -1,5 +1,3 @@
{
"persons": [
{
"id": "dark",
"signature": "Best regards,",
@ -11,5 +9,3 @@
"logoAlt": "dark logo",
"website": "http://dark.dk"
}
]
}

View File

@ -88,9 +88,11 @@ function buildTask(options){
.forEach(function readConfigurations(dir){
/** NB: For 'watch' to properly work, the cache needs to be deleted before each require. */
var confPath = '../tmp/' + dir + '/conf.json';
var current = null;
delete require.cache[require.resolve(confPath)];
promises.push(makeTemplates(dir, require(confPath).persons));
current = require(confPath);
promises.push(makeTemplates(dir, current.persons || [current]));
});
Q.all(promises);