mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-17 05:50:25 +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 plugins.prepareForBuild(targets);
|
||||||
await mkdirp(path.join(__dirname, '../../build/public'));
|
await mkdirp(path.join(__dirname, '../../build/public'));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
winston.error(`[build] Encountered error preparing for build\n${err.stack}`);
|
winston.error(`[build] Encountered error preparing for build`);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,7 +197,7 @@ exports.build = async function (targets, options) {
|
|||||||
await cacheBuster.write();
|
await cacheBuster.write();
|
||||||
winston.info(`[build] Asset compilation successful. Completed in ${totalTime}sec.`);
|
winston.info(`[build] Asset compilation successful. Completed in ${totalTime}sec.`);
|
||||||
} catch (err) {
|
} 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;
|
throw err;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ async function getTemplateDirs(activePlugins) {
|
|||||||
theme = themeConfig.baseTheme;
|
theme = themeConfig.baseTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
themeTemplates.push(nconf.get('base_templates_path'));
|
|
||||||
themeTemplates = _.uniq(themeTemplates.reverse());
|
themeTemplates = _.uniq(themeTemplates.reverse());
|
||||||
|
|
||||||
const coreTemplatesPath = nconf.get('core_templates_path');
|
const coreTemplatesPath = nconf.get('core_templates_path');
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ Themes.setupPaths = async () => {
|
|||||||
const themeObj = data.themesData.find(themeObj => themeObj.id === themeId);
|
const themeObj = data.themesData.find(themeObj => themeObj.id === themeId);
|
||||||
|
|
||||||
if (!themeObj) {
|
if (!themeObj) {
|
||||||
throw new Error('[[error:theme-not-found]]');
|
throw new Error('theme-not-found');
|
||||||
}
|
}
|
||||||
|
|
||||||
Themes.setPath(themeObj);
|
Themes.setPath(themeObj);
|
||||||
@@ -167,13 +167,16 @@ Themes.setupPaths = async () => {
|
|||||||
|
|
||||||
Themes.setPath = function (themeObj) {
|
Themes.setPath = function (themeObj) {
|
||||||
// Theme's templates path
|
// Theme's templates path
|
||||||
let themePath = nconf.get('base_templates_path');
|
let themePath;
|
||||||
const fallback = path.join(nconf.get('themes_path'), themeObj.id, 'templates');
|
const fallback = path.join(nconf.get('themes_path'), themeObj.id, 'templates');
|
||||||
|
|
||||||
if (themeObj.templates) {
|
if (themeObj.templates) {
|
||||||
themePath = path.join(nconf.get('themes_path'), themeObj.id, themeObj.templates);
|
themePath = path.join(nconf.get('themes_path'), themeObj.id, themeObj.templates);
|
||||||
} else if (file.existsSync(fallback)) {
|
} else if (file.existsSync(fallback)) {
|
||||||
themePath = 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);
|
nconf.set('theme_templates_path', themePath);
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ function loadConfig(configFile) {
|
|||||||
// Ensure themes_path is a full filepath
|
// Ensure themes_path is a full filepath
|
||||||
nconf.set('themes_path', path.resolve(paths.baseDir, nconf.get('themes_path')));
|
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('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_path', path.resolve(nconf.get('base_dir'), nconf.get('upload_path')));
|
||||||
nconf.set('upload_url', '/assets/uploads');
|
nconf.set('upload_url', '/assets/uploads');
|
||||||
|
|||||||
Reference in New Issue
Block a user