v1.18.x
Andrew Rodrigues 7 years ago
parent 9eac794e8e
commit ebd0899714

@ -11,6 +11,7 @@ var _ = require('lodash');
var plugins = require('../plugins'); var plugins = require('../plugins');
var file = require('../file'); var file = require('../file');
var db = require('../database');
var viewsPath = nconf.get('views_dir'); var viewsPath = nconf.get('views_dir');
@ -44,20 +45,16 @@ function processImports(paths, templatePath, source, callback) {
} }
Templates.processImports = processImports; Templates.processImports = processImports;
function getTemplateDirs(callback) { function getTemplateDirs(activePlugins, callback) {
var pluginTemplates = _.values(plugins.pluginsData) var pluginTemplates = activePlugins.map(function (id) {
.filter(function (pluginData) { return path.join(__dirname, '../../node_modules/', id, plugins.pluginsData[id].templates || 'templates');
return !pluginData.id.startsWith('nodebb-theme-'); });
})
.map(function (pluginData) {
return path.join(__dirname, '../../node_modules/', pluginData.id, pluginData.templates || 'templates');
});
var themeConfig = require(nconf.get('theme_config')); var themeConfig = require(nconf.get('theme_config'));
var theme = themeConfig.baseTheme; var theme = themeConfig.baseTheme;
var themePath; var themePath;
var themeTemplates = [nconf.get('theme_templates_path')]; var themeTemplates = [];
while (theme) { while (theme) {
themePath = path.join(nconf.get('themes_path'), theme); themePath = path.join(nconf.get('themes_path'), theme);
themeConfig = require(path.join(themePath, 'theme.json')); themeConfig = require(path.join(themePath, 'theme.json'));
@ -118,6 +115,9 @@ function compile(callback) {
function (next) { function (next) {
mkdirp(viewsPath, function (err) { next(err); }); mkdirp(viewsPath, function (err) { next(err); });
}, },
function (next) {
db.getSortedSetRange('plugins:active', 0, -1, next);
},
getTemplateDirs, getTemplateDirs,
getTemplateFiles, getTemplateFiles,
function (files, next) { function (files, next) {

Loading…
Cancel
Save