preload app css (#8752)

This commit is contained in:
tamaina 2022-05-29 10:57:06 +09:00 committed by GitHub
parent e54aa56ee1
commit 4917961736
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 15 deletions

View File

@ -46,7 +46,7 @@ export default function load() {
mixin.authUrl = `${mixin.scheme}://${mixin.host}/auth`; mixin.authUrl = `${mixin.scheme}://${mixin.host}/auth`;
mixin.driveUrl = `${mixin.scheme}://${mixin.host}/files`; mixin.driveUrl = `${mixin.scheme}://${mixin.host}/files`;
mixin.userAgent = `Misskey/${meta.version} (${config.url})`; mixin.userAgent = `Misskey/${meta.version} (${config.url})`;
mixin.clientEntry = clientManifest['src/init.ts'].file.replace(/^_client_dist_\//, ''); mixin.clientEntry = clientManifest['src/init.ts'];
if (!config.redis.prefix) config.redis.prefix = mixin.host; if (!config.redis.prefix) config.redis.prefix = mixin.host;

View File

@ -74,9 +74,9 @@ app.use(views(_dirname + '/views', {
extension: 'pug', extension: 'pug',
options: { options: {
version: config.version, version: config.version,
clientEntry: () => process.env.NODE_ENV === 'production' ? getClientEntry: () => process.env.NODE_ENV === 'production' ?
config.clientEntry : config.clientEntry :
JSON.parse(readFileSync(`${_dirname}/../../../../../built/_client_dist_/manifest.json`, 'utf-8'))['src/init.ts'].file.replace(/^_client_dist_\//, ''), JSON.parse(readFileSync(`${_dirname}/../../../../../built/_client_dist_/manifest.json`, 'utf-8'))['src/init.ts'],
config, config,
}, },
})); }));

View File

@ -1,17 +1,23 @@
block vars block vars
block loadClientEntry
- const clientEntry = getClientEntry();
doctype html doctype html
!= '<!--\n' //
!= ' _____ _ _ \n' -
!= ' | |_|___ ___| |_ ___ _ _ \n'
!= ' | | | | |_ -|_ -| \'_| -_| | |\n' _____ _ _
!= ' |_|_|_|_|___|___|_,_|___|_ |\n' | |_|___ ___| |_ ___ _ _
!= ' |___|\n' | | | | |_ -|_ -| \'_| -_| | |
!= ' Thank you for using Misskey!\n' |_|_|_|_|___|___|_,_|___|_ |
!= ' If you are reading this message... how about joining the development?\n' |___|
!= ' https://github.com/misskey-dev/misskey' Thank you for using Misskey!
!= '\n-->\n' If you are reading this message... how about joining the development?
https://github.com/misskey-dev/misskey
html html
@ -30,9 +36,11 @@ html
link(rel='prefetch' href='https://xn--931a.moe/assets/info.jpg') link(rel='prefetch' href='https://xn--931a.moe/assets/info.jpg')
link(rel='prefetch' href='https://xn--931a.moe/assets/not-found.jpg') link(rel='prefetch' href='https://xn--931a.moe/assets/not-found.jpg')
link(rel='prefetch' href='https://xn--931a.moe/assets/error.jpg') link(rel='prefetch' href='https://xn--931a.moe/assets/error.jpg')
link(rel='preload' href='/assets/fontawesome/css/all.css' as='style')
link(rel='stylesheet' href='/assets/fontawesome/css/all.css') link(rel='stylesheet' href='/assets/fontawesome/css/all.css')
each href in clientEntry.css
link(rel='preload' href=`/assets/${href}` as='style')
title title
block title block title
= title || 'Misskey' = title || 'Misskey'
@ -52,7 +60,7 @@ html
script. script.
var VERSION = "#{version}"; var VERSION = "#{version}";
var CLIENT_ENTRY = "#{clientEntry()}"; var CLIENT_ENTRY = "#{clientEntry.file}";
script script
include ../boot.js include ../boot.js