Skip to content

Commit

Permalink
fix: do not apply ignore patterns to _fonts public dir
Browse files Browse the repository at this point in the history
resolves #122
  • Loading branch information
danielroe committed Apr 17, 2024
1 parent d3cbcdb commit 4952673
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 16,12 @@ import { formatToExtension, parseFont } from './css/render'
import type { FontFaceData, ModuleOptions, NormalizedFontFaceData } from './types'

// TODO: replace this with nuxt/assets when it is released
export function setupPublicAssetStrategy(options: ModuleOptions['assets'] = {}) {
export function setupPublicAssetStrategy (options: ModuleOptions['assets'] = {}) {

Check failure on line 19 in src/assets.ts

View workflow job for this annotation

GitHub Actions / ci

Unexpected space before function parentheses
const assetsBaseURL = options.prefix || '/_fonts'
const nuxt = useNuxt()
const renderedFontURLs = new Map<string, string>()

function normalizeFontData(faces: FontFaceData | FontFaceData[]): NormalizedFontFaceData[] {
function normalizeFontData (faces: FontFaceData | FontFaceData[]): NormalizedFontFaceData[] {

Check failure on line 24 in src/assets.ts

View workflow job for this annotation

GitHub Actions / ci

Unexpected space before function parentheses
const data: NormalizedFontFaceData[] = []
for (const face of Array.isArray(faces) ? faces : [faces]) {
data.push({
Expand Down Expand Up @@ -82,13 82,14 @@ export function setupPublicAssetStrategy(options: ModuleOptions['assets'] = {})

nuxt.options.nitro.publicAssets ||= []
const cacheDir = join(nuxt.options.buildDir, 'cache', 'fonts')
nuxt.options.nitro.publicAssets.push()

nuxt.options.nitro = defu(nuxt.options.nitro, {
publicAssets: [{
dir: cacheDir,
maxAge: ONE_YEAR_IN_SECONDS,
baseURL: assetsBaseURL,
}],
ignore: [`!${join(cacheDir, '**/*')}`],
prerender: {
ignore: [assetsBaseURL],
},
Expand Down

0 comments on commit 4952673

Please sign in to comment.