From e5cd2fd64924e50d1523e3affdd993692f94e3e8 Mon Sep 17 00:00:00 2001 From: Dan Mindru Date: Fri, 19 Aug 2016 22:47:53 +0200 Subject: [PATCH] Allow single conf objects too --- src/dark/conf.json | 22 +++++++++------------- tasks/build.js | 4 +++- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/dark/conf.json b/src/dark/conf.json index 5641aec..02a5253 100644 --- a/src/dark/conf.json +++ b/src/dark/conf.json @@ -1,15 +1,11 @@ { - "persons": [ - { - "id": "dark", - "signature": "Best regards,", - "name": "The dark mail team", - "contactMain": "Call (45) 80100100 or email us at", - "contactMail": "info@dark.dk", - "slogan": "LED Pylon. LED Wall. Digital Signage.", - "logoUrl": "/assets/dark.png", - "logoAlt": "dark logo", - "website": "http://dark.dk" - } - ] + "id": "dark", + "signature": "Best regards,", + "name": "The dark mail team", + "contactMain": "Call (45) 80100100 or email us at", + "contactMail": "info@dark.dk", + "slogan": "LED Pylon. LED Wall. Digital Signage.", + "logoUrl": "/assets/dark.png", + "logoAlt": "dark logo", + "website": "http://dark.dk" } diff --git a/tasks/build.js b/tasks/build.js index 82a2dc3..cc7fe86 100644 --- a/tasks/build.js +++ b/tasks/build.js @@ -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);