0

In PageSpeed Insights:
Ensure text remains visible during Webfont load
Leverage the font-display CSS feature to ensure text is user-visible while web fonts are loading.

Blank-Theme-Icons/Blank-Theme-Icons.woff2
I want to use this font in my custom theme and adding

font-display :swap

2 Answers 2

2

Include the Blank-Theme-Icons.woff2 font in your CSS file by adding below lines in your theme's CSS file.

@font-face {
  font-family: 'icons-blank-theme';
  src: url('../fonts/Blank-Theme-Icons/Blank-Theme-Icons.woff2') format('woff2'), url('../fonts/Blank-Theme-Icons/Blank-Theme-Icons.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

Hope it helps!!!

4
  • 1
    Thank's @sumit. It's working Commented Sep 6, 2019 at 6:51
  • Leverage the font-display CSS for en_US/fonts/Luma-Icons.woff2 , how can we fix this ? Commented Jun 3, 2020 at 13:06
  • @Pravin, you got solution? Commented Sep 12, 2020 at 10:07
  • @Sumit, can we use this in our custom css file ? as we already have this file still while deploying we are facing No matching definition was found for `@family-name:'icons-blank-theme' Commented Dec 29, 2021 at 6:41
1

Create new file _icons.less (app/design/frontend///web/css/source/_icons.less)

And paste this code

// /**
//  * Copyright © Magento, Inc. All rights reserved.
//  * See COPYING.txt for license details.
//  */

& when (@media-common = true) {
    .lib-font-face(
        @family-name: @icons__font-name,
        @font-path: @icons__font-path,
        @font-weight: normal,
        @font-style: normal,
        @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.