Skip to content

Node.js based forum software built for the modern web

almost had a heartattack when I saw 121 changed files in this conflict

psychobunny933115a85308
diff --cc src/meta/templates.js
index 01c7aca70e,8df981c572..04d9d31009
--- a/src/meta/templates.js
+++ b/src/meta/templates.js
@@@ -28,30 -27,25 +28,33 @@@ Templates.compile = function(callback)
return 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'),
- themeConfig = require(nconf.get('theme_config'));
+ compile(callback);
+};
- 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');
- }
+function getBaseTemplates(theme) {
+ var baseTemplatesPaths = [],
+ baseThemePath, baseThemeConfig;
+
+ while (theme) {
+ baseThemePath = path.join(nconf.get('themes_path'), theme);
+ baseThemeConfig = require(path.join(baseThemePath, 'theme.json'));
+
+ baseTemplatesPaths.push(path.join(baseThemePath, baseThemeConfig.templates || 'templates'));
+ theme = baseThemeConfig.baseTheme;
}
+ return baseTemplatesPaths.reverse();
+}
+
+function preparePaths(baseTemplatesPaths, callback) {
+ var coreTemplatesPath = nconf.get('core_templates_path'),
+ viewsPath = nconf.get('views_dir');
+
- plugins.getTemplates(function(err, pluginTemplates) {
+ async.waterfall([
+ async.apply(plugins.fireHook, 'static:templates.precompile', {}),
+ async.apply(plugins.getTemplates)
+ ], function(err, pluginTemplates) {
if (err) {
return callback(err);
}