File tree Expand file tree Collapse file tree 4 files changed +17
-22
lines changed
Expand file tree Collapse file tree 4 files changed +17
-22
lines changed Original file line number Diff line number Diff line change @@ -4,5 +4,6 @@ declare module 'unfonts.css' {
44}
55
66declare module 'unplugin-fonts/head' {
7- export const links : string [ ]
7+ import { HtmlTagDescriptor } from "vite"
8+ export const links : HtmlTagDescriptor [ ]
89}
Original file line number Diff line number Diff line change 22import Unfont from ' unplugin-fonts/astro/component.astro' ;
33---
44
5- <div >
6- <Unfont />
7- <h1 >Hello Astro!</h1 >
8- <h2 >I'm using a local font !</h2 >
9- <a href =" https://vitejs.dev/guide/features.html" target =" _blank" >Documentation</a >
10- </div >
5+ <html >
6+ <head >
7+ <Unfont />
8+ </head >
9+ <body >
10+ <h1 >Hello Astro!</h1 >
11+ <h2 >I'm using a local font !</h2 >
12+ <a href =" https://vitejs.dev/guide/features.html" target =" _blank" >Documentation</a >
13+ </body >
14+ </html >
1115
1216<style >
1317 body {
Original file line number Diff line number Diff line change 1+ import type { AstroIntegration } from 'astro'
12import type { Options } from './types'
23import unplugin from '.'
3- // import { getHeadLinkTags } from './loaders'
44
55export default function ( options : Options ) {
6- return {
6+ return < AstroIntegration > {
77 name : 'unplugin-fonts' ,
88 hooks : {
9- 'astro:config:setup' : async ( astro : any ) => {
9+ 'astro:config:setup' : async ( astro ) => {
1010 if ( options ?. custom )
1111 options . custom . stripPrefix = 'public/'
1212
1313 astro . config . vite . plugins ||= [ ]
1414 astro . config . vite . plugins . push ( unplugin . vite ( options ) )
1515
16- // const links = getHeadLinkTags(options, astro.config.root.toString())
17- // const linksString: string[] = []
18-
19- // for (const link of links) {
20- // linksString.push(`<link ${Object.entries(link.attrs || {}).map(([key, value]) => `${key}="${value}"`).join(' ')} />`)
21- // }
22-
2316 astro . injectScript ( 'page-ssr' , 'import "unfonts.css";' )
2417 } ,
2518 } ,
Original file line number Diff line number Diff line change 11---
2- import type { HtmlTagDescriptor } from ' vite'
3-
4- // @ts-ignore
52import { links } from ' unplugin-fonts/head'
63---
74
85<>
9- { links .map ((link : HtmlTagDescriptor ) => {
6+ { links .map ((link ) => {
107 const attrs = link ?.attrs || {}
118 return (
129 <link { ... attrs } />
1310 )
1411 })}
15- </>
12+ </>
You can’t perform that action at this time.
0 commit comments