You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While reading through the source code, I noticed, that generating tags is unconditional for all generated link tags. Thus whenever a bundled asset matches the filename pattern for a font file, there will be a tag for it. Kinda unintuitively the settings under options.custom.prefetch and options.custom.preload are applied for all fonts, including Google Fonts, Font Source, etc.
Unfortunately, there's a bit of code duplication for the actual link tag generation, which makes the fix for this a bit spread all around the code base.
The outline for this is basically:
Find all places where getHeadLinkTags is called.
Look at the for (const file of files) loop directly below
The tags.push() there needs to be conditional on options.custom.prefetch || options.custom.preload
While at it and looking in the context of #10, after that for loop is also the ideal place to introduce a new callback options.custom.linkFilter hook, that in the simplest case just receives the tags array and could then do:
return true -> return tags unaltered
return false -> return no tags
return a modified tag array -> forward the modified choice of headers to generate
Demo URL
No response
What happened?
setting preload: false does not work for custom font
Reproduction steps
1. add preload: false to options 2. observe that fonts are still preloaded
Relevant log output
No response
What browsers are you seeing the problem on?
Chrome
What is your operating system?
MacOS
The text was updated successfully, but these errors were encountered: