mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: #11396, removal of base_templates_path variable
This commit is contained in:
@@ -70,7 +70,7 @@ async function beforeBuild(targets) {
|
||||
await plugins.prepareForBuild(targets);
|
||||
await mkdirp(path.join(__dirname, '../../build/public'));
|
||||
} catch (err) {
|
||||
winston.error(`[build] Encountered error preparing for build\n${err.stack}`);
|
||||
winston.error(`[build] Encountered error preparing for build`);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ exports.build = async function (targets, options) {
|
||||
await cacheBuster.write();
|
||||
winston.info(`[build] Asset compilation successful. Completed in ${totalTime}sec.`);
|
||||
} catch (err) {
|
||||
winston.error(`[build] Encountered error during build step\n${err.stack ? err.stack : err}`);
|
||||
winston.error(`[build] Encountered error during build step`);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -65,7 +65,6 @@ async function getTemplateDirs(activePlugins) {
|
||||
theme = themeConfig.baseTheme;
|
||||
}
|
||||
|
||||
themeTemplates.push(nconf.get('base_templates_path'));
|
||||
themeTemplates = _.uniq(themeTemplates.reverse());
|
||||
|
||||
const coreTemplatesPath = nconf.get('core_templates_path');
|
||||
|
||||
@@ -159,7 +159,7 @@ Themes.setupPaths = async () => {
|
||||
const themeObj = data.themesData.find(themeObj => themeObj.id === themeId);
|
||||
|
||||
if (!themeObj) {
|
||||
throw new Error('[[error:theme-not-found]]');
|
||||
throw new Error('theme-not-found');
|
||||
}
|
||||
|
||||
Themes.setPath(themeObj);
|
||||
@@ -167,13 +167,16 @@ Themes.setupPaths = async () => {
|
||||
|
||||
Themes.setPath = function (themeObj) {
|
||||
// Theme's templates path
|
||||
let themePath = nconf.get('base_templates_path');
|
||||
let themePath;
|
||||
const 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 (file.existsSync(fallback)) {
|
||||
themePath = fallback;
|
||||
} else {
|
||||
winston.error('[themes] Unable to resolve this theme\'s templates. Expected to be at "templates/" or defined in the "templates" property of "theme.json"');
|
||||
throw new Error('theme-missing-templates');
|
||||
}
|
||||
|
||||
nconf.set('theme_templates_path', themePath);
|
||||
|
||||
@@ -75,7 +75,6 @@ function loadConfig(configFile) {
|
||||
// Ensure themes_path is a full filepath
|
||||
nconf.set('themes_path', path.resolve(paths.baseDir, nconf.get('themes_path')));
|
||||
nconf.set('core_templates_path', path.join(paths.baseDir, 'src/views'));
|
||||
nconf.set('base_templates_path', path.join(nconf.get('themes_path'), 'nodebb-theme-harmony/templates'));
|
||||
|
||||
nconf.set('upload_path', path.resolve(nconf.get('base_dir'), nconf.get('upload_path')));
|
||||
nconf.set('upload_url', '/assets/uploads');
|
||||
|
||||
Reference in New Issue
Block a user