From c905f961082a819530e4c722f2c5ec80aa4f260c Mon Sep 17 00:00:00 2001 From: psychobunny Date: Thu, 20 Nov 2014 17:50:01 -0500 Subject: [PATCH] closes #2412 --- src/meta/templates.js | 12 +++++++++++- src/meta/themes.js | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/meta/templates.js b/src/meta/templates.js index 9625969947..9fd6697aae 100644 --- a/src/meta/templates.js +++ b/src/meta/templates.js @@ -27,7 +27,17 @@ Templates.compile = function(callback) { var coreTemplatesPath = nconf.get('core_templates_path'), baseTemplatesPath = nconf.get('base_templates_path'), viewsPath = nconf.get('views_dir'), - themeTemplatesPath = nconf.get('theme_templates_path'); + themeTemplatesPath = nconf.get('theme_templates_path'), + themeConfig = require(nconf.get('theme_config')); + + if (themeConfig.baseTheme) { + var pathToBaseTheme = path.join(nconf.get('themes_path'), themeConfig.baseTheme), + baseTemplatesPath = require(path.join(pathToBaseTheme, 'theme.json')).templates; + + if (!baseTemplatesPath){ + baseTemplatesPath = path.join(pathToBaseTheme, 'templates'); + } + } plugins.getTemplates(function(err, pluginTemplates) { if (err) { diff --git a/src/meta/themes.js b/src/meta/themes.js index dc26a1bc83..dde10c3786 100644 --- a/src/meta/themes.js +++ b/src/meta/themes.js @@ -111,6 +111,7 @@ module.exports = function(Meta) { // Theme's templates path var themePath = nconf.get('base_templates_path'), fallback = path.join(nconf.get('themes_path'), themeObj.id, 'templates'); + if (themeObj.templates) { themePath = path.join(nconf.get('themes_path'), themeObj.id, themeObj.templates); } else if (fs.existsSync(fallback)) { @@ -118,5 +119,6 @@ module.exports = function(Meta) { } nconf.set('theme_templates_path', themePath); + nconf.set('theme_config', path.join(nconf.get('themes_path'), themeObj.id, 'theme.json')); }; }; \ No newline at end of file