Skip to content

Node.js based forum software built for the modern web

closes #2412

psychobunnyc905f961082a
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