Skip to content

Commit

Permalink
Demo - Preload fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
smastrom committed Sep 1, 2024
1 parent a397aef commit d6832b6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 10 additions & 0 deletions playground/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ import SimpleNotification, {
type SimpleNotificationProps,
} from '@/components/custom-notifications/SimpleNotification.vue'
useServerHead({
link: ['regular', '700'].map((w) => ({
rel: 'preload',
href: `pt-sans-narrow-v17-latin-${w}.woff2`,
as: 'font',
type: 'font/woff2',
crossorigin: '',
})),
})
const { state } = useStore()
const config = useNotivue()
Expand Down
7 changes: 3 additions & 4 deletions playground/assets/style.css
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
@font-face {
font-display: swap;
font-family: 'Inter';
font-style: normal;
font-weight: 400;
src: url('inter-v13-latin-500.woff2') format('woff2');
}

@font-face {
font-display: swap;
font-family: 'Inter';
font-style: normal;
font-weight: 700;
src: url('inter-v13-latin-700.woff2') format('woff2');
}

@font-face {
font-display: swap;
font-family: 'PT Sans Narrow';
font-style: normal;
font-weight: 400;
src: url('pt-sans-narrow-v17-latin-regular.woff2') format('woff2');
font-display: block;
}

@font-face {
font-display: swap;
font-family: 'PT Sans Narrow';
font-style: normal;
font-weight: 700;
src: url('pt-sans-narrow-v17-latin-700.woff2') format('woff2');
font-display: block;
}

:root {
Expand Down

0 comments on commit d6832b6

Please sign in to comment.