astro-font will automatically optimize your Custom Fonts, Local Fonts, Fonts over any CDN and Google fonts for performance.
astro-font@0.0.80 (latest)
In astro-font@^0.0.80, the CSS font parser for fonts loading over CDN such as Google Fonts, TypeKit, etc. has improved. It’s now able to map over each attribute of font-face property returned by CDN, and creates an equivalent CSS.
To create in-browser like requests, each outgoing request is appended with the 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36'
header. This helps obtain the unicode-range
which optimizes the in-browser font downloading as if the page doesn’t use any character in that range, the font is not downloaded at all.
astro-font@0.0.79
In astro-font@^0.0.79, there are type values introduced for the following CSS properties, allowing you to choose the values based on standard web practices in your IDE.
To keep it backward compatible, any kind of string or number value is allowed.
-
style: https://developer.mozilla.org/en-US/docs/Web/CSS/font-style
-
weight: https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
-
display: https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display
Thank you Florian Lefebvre for this amazing contribution!
astro-font@0.0.78
astro-font@0.0.77
astro-font@0.0.76
- introduce per config
verbose
flag to create less noise in terminals
astro-font@0.0.75
- introduce
fallbackName
per config flag to allow customizing fallback font’s name
astro-font@0.0.74
- only use
pathe
for relativizing the paths to get POSIX like output for font paths (thanks to @florian-lefebvre for suggesting it & @pi0 for making pathe)
astro-font@0.0.73
- use
pathe
instead of relying on node:path to support all environments
astro-font@0.0.72
- custom patch duplicate
axisIndex:o,axisIndex:o
bug of the corefontkit
library (thanks to @lukasborawski for reaching out and suggesting the fix)
astro-font@0.0.71
- add support for Google Fonts URLs + Any CDN URL that responds back with CSS
astro-font@0.0.70
- remove
github-slugger
as the package dependency
astro-font@0.0.69
- allow granular configuration of preloads per font per config
- hide errors occured during determining write access (for lesser noise in terminals)
astro-font@0.0.68
- introduce
cssVariable
per config optional flag to shipfont-family
style in a CSS variable - make
selector
per config optional
astro-font@0.0.67
- gracefully handles non fallback-font computation scenarios
- introduce
fetch
per config flag to decide which set of fonts to be localized - files are NOT fetched and localized by default, everything remains as-is to provide a better DX
- gracefully handles non-caching scenarios
- got rid of custom
.astro_font
directory for caching (less things to see/learn)
References
- GitHub: astro-font
- Astro, SvelteKit and Next.js Starter Kits: launchfa.st