3

How is it possible to add to Magento 2 fonts font-display: swap ?

I don't find the correct way in the typography.less, or in a custom CSS file, it breaks all the CSS.

.lib-font-face(
    @family-name: @font-family-name__base,
    @font-path: '@{baseDir}fonts/opensans/semibold/opensans-600',
    @font-weight: 600,
    @font-style: normal
);

Thank you for your ideas!

1 Answer 1

2

you can add it to your file _typography.less changed mixin .lib-font-face( @family-name, @font-path, @font-weight: normal, @font-style: normal, @font-display: swap ) { @font-face { font-family: @family-name; src: url('@{font-path}.woff2') format('woff2'), url('@{font-path}.woff') format('woff'); font-weight: @font-weight; font-style: @font-style; font-display: swap; } }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.