3

I've created a theme in Magento2 which inherits from the Luma theme. So it has inherited it's lib-font-face, which can be found in the styles-m.css

@font-face {
  font-family: 'luma-icons';
  src: url('../fonts/Luma-Icons.eot');
  src: url('../fonts/Luma-Icons.eot?#iefix') format('embedded-opentype'), url('../fonts/Luma-Icons.woff2') format('woff2'), url('../fonts/Luma-Icons.woff') format('woff'), url('../fonts/Luma-Icons.ttf') format('truetype'), url('../fonts/Luma-Icons.svg#luma-icons') format('svg');
  font-weight: normal;
  font-style: normal;
}

I don't want to use these, so it's pointless HTTP request.

How can I remove them?

2 Answers 2

0

I discovered that are defined in: lib/web/css/source/lib/variables/_typography.less

The guys at ClassyLama have a great article on it here: https://www.classyllama.com/blog/icon-fonts-magento-2-foundation

1
  • Thanks! How did you completly remove the default Luma-Icons font?
    – JGeer
    Commented May 28, 2020 at 9:42
0

To remove Luma-Icons put this in your theme's default_head_blocks.xml:

<remove src="fonts/Luma-Icons.woff2" />

If you don't use OpenSans anywhere you can also put this in the file:

<remove src="fonts/opensans/light/opensans-300.woff2" />
<remove src="fonts/opensans/regular/opensans-400.woff2" />
<remove src="fonts/opensans/semibold/opensans-600.woff2" />
<remove src="fonts/opensans/bold/opensans-700.woff2" />

Then just clear the layout cache: bin/magento cache:clean layout

1
  • 1
    Still working perfectly as of Magento CE 2.4.6, thanks!
    – Louis B.
    Commented Nov 9, 2023 at 8:52

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.