getFontLinks()font-display: swap (FOUT) instead of font-display: block for better
performance and less potential for layout shifts.@porsche-design-system/components-{js|angular|react|vue} packages
which needs to be injected into the <head> of your index.html.type FontWeight = 'thin' | 'regular' | 'semi-bold' | 'bold'subset'latin' | 'greek' | 'cyril' | 'arabic' | 'pashto' | 'urdu''latin'weightsFontWeight[]['regular', 'semi-bold']cdn'auto' | 'cn''auto'formatjsx it returns valid jsx elements. When using the js option a javascript object is returned.'html' | 'jsx' | 'js''html'jsx in the format option, it is necessary to have react/jsx-runtime as a dependency in the project
included.<!-- index.html -->
<head>
<!--PLACEHOLDER_FONT_LINKS-->
</head>
<!-- package.json (tested on macOS, the script may need to be adjusted depending on the operating system used) -->
<!-- make sure to adjust the path to the index.html file -->
"scripts": {
"prestart": "yarn replace",
"replace": "placeholder='<!--PLACEHOLDER_FONT_LINKS-->' && partial=$placeholder$(node -e 'console.log(require(\"@porsche-design-system/components-js/partials\").getFontLinks())') && regex=$placeholder'.*' && sed -i '' -E -e \"s^$regex^$partial^\" index.html"
<!-- Alternative: Force using China CDN -->
"replace": "placeholder='<!--PLACEHOLDER_FONT_LINKS-->' && partial=$placeholder$(node -e 'console.log(require(\"@porsche-design-system/components-js/partials\").getFontLinks({ cdn: \"cn\" }))') && regex=$placeholder'.*' && sed -i '' -E -e \"s^$regex^$partial^\" index.html"
}<link rel=preload href=https://cdn.ui.porsche.com/porsche-design-system/fonts/porsche-next-latin-regular.b8f1c20.woff2 as=font type=font/woff2 crossorigin>
<link rel=preload href=https://cdn.ui.porsche.com/porsche-design-system/fonts/porsche-next-latin-semi-bold.b5f6fca.woff2 as=font type=font/woff2 crossorigin>
// Alternative: Force using China CDN
<link rel=preload href=https://cdn.ui.porsche.cn/porsche-design-system/fonts/porsche-next-latin-regular.b8f1c20.woff2 as=font type=font/woff2 crossorigin>
<link rel=preload href=https://cdn.ui.porsche.cn/porsche-design-system/fonts/porsche-next-latin-semi-bold.b5f6fca.woff2 as=font type=font/woff2 crossorigin>
