Allow nodes to access resolved theme files

Fixes #2968
This commit is contained in:
Nick O'Leary
2021-04-29 10:17:07 +01:00
parent 6da8e92f20
commit cd3aba2b89
3 changed files with 37 additions and 2 deletions

View File

@@ -129,6 +129,14 @@ module.exports = {
}
themeContext.page.title = theme.page.title || themeContext.page.title;
// Store the resolved urls to these resources so nodes (such as Debug)
// can access them
theme.page._ = {
css: themeContext.page.css,
scripts: themeContext.page.scripts,
favicon: themeContext.page.favicon
}
}
if (theme.header) {
@@ -223,6 +231,7 @@ module.exports = {
themePlugin.path
);
themeContext.page.css = cssFiles.concat(themeContext.page.css || [])
theme.page._.css = cssFiles.concat(theme.page._.css || [])
}
if (themePlugin.scripts) {
const scriptFiles = serveFilesFromTheme(
@@ -232,6 +241,7 @@ module.exports = {
themePlugin.path
)
themeContext.page.scripts = scriptFiles.concat(themeContext.page.scripts || [])
theme.page._.scripts = cssFiles.concat(theme.page._.scripts || [])
}
}
activeThemeInitialised = true;