fix: fix preload

This commit is contained in:
webfussel 2024-05-29 09:01:11 +02:00
parent 8f4702782b
commit b9e9e2d691
6 changed files with 32 additions and 29 deletions

25
app.vue
View file

@ -27,31 +27,6 @@ useSeoMeta({
</script>
<style>
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
font-stretch: 100%;
font-display: swap;
src: url('/opensans.woff2') format('woff2');
}
@font-face {
font-family: 'Roboto Condensed';
font-style: normal;
font-weight: 300;
font-display: swap;
src: url('/roboto_con_reg.woff2') format('woff2');
}
@font-face {
font-family: 'Roboto Condensed';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url('/roboto_con_bold.woff2') format('woff2');
}
* {
margin: 0;
padding: 0;

24
assets/css/fonts.css Normal file
View file

@ -0,0 +1,24 @@
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
font-stretch: 100%;
font-display: swap;
src: url('/fonts/opensans.woff2') format('woff2');
}
@font-face {
font-family: 'Roboto Condensed';
font-style: normal;
font-weight: 300;
font-display: swap;
src: url('/fonts/roboto_con_reg.woff2') format('woff2');
}
@font-face {
font-family: 'Roboto Condensed';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url('/fonts/roboto_con_bold.woff2') format('woff2');
}

View file

@ -1,4 +1,5 @@
export default defineNuxtConfig({
ssr: true,
nitro: {
prerender: {
routes: [
@ -7,6 +8,9 @@ export default defineNuxtConfig({
]
}
},
css: [
'~/assets/css/fonts.css'
],
routeRules: {
'/': { prerender: true },
'/imp': { prerender: true },
@ -17,10 +21,10 @@ export default defineNuxtConfig({
link: [
{ rel: 'preload', as: 'image', href: '/img/profile_big.webp', type: 'image/webp' },
{ rel: 'preload', as: 'image', href: '/img/profile_small.webp', type: 'image/webp' },
{ rel: 'preload', as: 'font', href: '/opensans.woff2', type: 'font/woff2' },
{ rel: 'preload', as: 'font', href: '/roboto_con_bold.woff2', type: 'font/woff2' },
{ rel: 'preload', as: 'font', href: '/roboto_con_reg.woff2', type: 'font/woff2' },
]
{ rel: 'preload', crossorigin: 'anonymous', as: 'font', href: '/fonts/opensans.woff2', type: 'font/woff2' },
{ rel: 'preload', crossorigin: 'anonymous', as: 'font', href: '/fonts/roboto_con_bold.woff2', type: 'font/woff2' },
{ rel: 'preload', crossorigin: 'anonymous', as: 'font', href: '/fonts/roboto_con_reg.woff2', type: 'font/woff2' },
],
}
}
})