Added preload to custom scripts and styles so they can load earlier
This commit is contained in:
parent
08e3164e84
commit
d8f6a59f17
@ -17,6 +17,7 @@ export default async function handler(req, res) {
|
||||
if (!['custom.css', 'custom.js'].includes(relativePath))
|
||||
{
|
||||
res.status(422).end('Unsupported file')
|
||||
return // do not continue in the function
|
||||
}
|
||||
|
||||
const filePath = path.join(CONF_DIR, relativePath);
|
||||
|
||||
@ -313,14 +313,16 @@ function Home({ initialSettings }) {
|
||||
<meta name="theme-color" content={themes[settings.color || "slate"][settings.theme || "dark"]} />
|
||||
</Head>
|
||||
|
||||
<style alt="custom">
|
||||
<link rel="preload" href="/api/config/custom.css" as="fetch" crossorigin="anonymous" />
|
||||
<style data-name="custom.css">
|
||||
<FileContent path="custom.css"
|
||||
loadingValue="/* Loading custom CSS... */"
|
||||
errorValue="/* Failed to load custom CSS... */"
|
||||
emptyValue="/* No custom CSS */"
|
||||
/>
|
||||
</style>
|
||||
<script alt="custom">
|
||||
<link rel="preload" href="/api/config/custom.js" as="fetch" crossorigin="anonymous" />
|
||||
<script data-name="custom.js">
|
||||
<FileContent path="custom.js"
|
||||
loadingValue="/* Loading custom JS... */"
|
||||
errorValue="/* Failed to load custom JS... */"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user