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,15 +1,11 @@
{ {
"persons": [ "id": "dark",
{ "signature": "Best regards,",
"id": "dark", "name": "The dark mail team",
"signature": "Best regards,", "contactMain": "Call <a href='tel:004580100100'><span>(45) 80100100</span></a> or email us at",
"name": "The dark mail team", "contactMail": "info@dark.dk",
"contactMain": "Call <a href='tel:004580100100'><span>(45) 80100100</span></a> or email us at", "slogan": "LED Pylon. LED Wall. Digital Signage.",
"contactMail": "info@dark.dk", "logoUrl": "/assets/dark.png",
"slogan": "LED Pylon. LED Wall. Digital Signage.", "logoAlt": "dark logo",
"logoUrl": "/assets/dark.png", "website": "http://dark.dk"
"logoAlt": "dark logo",
"website": "http://dark.dk"
}
]
} }

View File

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