Unverified Commit 6d3be75b authored by Janicklas Ralph's avatar Janicklas Ralph Committed by GitHub

Adding data attr to inlined font definition (#44008)

Adding data attr to inlined font definition from optimizeFonts feature
parent 7b84d63e
...@@ -135,9 +135,15 @@ class FontOptimizerMiddleware implements PostProcessMiddleware { ...@@ -135,9 +135,15 @@ class FontOptimizerMiddleware implements PostProcessMiddleware {
result = result.replace('</head>', `${fallBackLinkTag}</head>`) result = result.replace('</head>', `${fallBackLinkTag}</head>`)
} else { } else {
const nonceStr = nonce ? ` nonce="${nonce}"` : '' const nonceStr = nonce ? ` nonce="${nonce}"` : ''
let dataAttr = ''
if (fontContent.includes('ascent-override')) {
dataAttr = ' data-size-adjust="true"'
}
result = result.replace( result = result.replace(
'</head>', '</head>',
`<style data-href="${url}"${nonceStr}>${fontContent}</style></head>` `<style data-href="${url}"${nonceStr}${dataAttr}>${fontContent}</style></head>`
) )
// Remove inert font tag // Remove inert font tag
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment