Skip to content

Commit b1049ee

Browse files
committed
fix: log when we are downloading fonts
1 parent a840e4d commit b1049ee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/assets.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import fsp from 'node:fs/promises'
2-
import { addDevServerHandler, useNuxt } from '@nuxt/kit'
2+
import { addDevServerHandler, useLogger, useNuxt } from '@nuxt/kit'
33
import { eventHandler, createError } from 'h3'
44
import { fetch } from 'ofetch'
55
import { defu } from 'defu'
@@ -16,6 +16,7 @@ import type { FontFaceData, ModuleOptions, NormalizedFontFaceData } from './type
1616
export function setupPublicAssetStrategy (options: ModuleOptions['assets'] = {}) {
1717
const assetsBaseURL = options.prefix || '/_fonts'
1818
const nuxt = useNuxt()
19+
const logger = useLogger('@nuxt/fonts')
1920
const renderedFontURLs = new Map<string, string>()
2021

2122
function normalizeFontData (faces: FontFaceData | FontFaceData[]): NormalizedFontFaceData[] {
@@ -79,6 +80,7 @@ export function setupPublicAssetStrategy (options: ModuleOptions['assets'] = {})
7980
nitro.hooks.hook('rollup:before', async () => {
8081
await fsp.rm(cacheDir, { recursive: true, force: true })
8182
await fsp.mkdir(cacheDir, { recursive: true })
83+
logger.info('Downloading uncached fonts...')
8284
for (const [filename, url] of renderedFontURLs) {
8385
const key = 'data:' + filename
8486
// Use nitro.storage to cache the font data between builds

0 commit comments

Comments
 (0)