0

I need to remove Open Sans font in our Magento2 site. I have inherited the luma theme, so how to override the blank theme _typography.less file?

1
  • 1
    copy the file in your theme and change it how you want
    – Marius
    Commented Jan 9, 2019 at 8:30

2 Answers 2

5

In addition to Sourav's answer, from what I can tell under Magento 2.3.3 you also need to override the vendor/magento/theme-frontend-luma/Magento_Theme/layout/default_head_blocks.xml file in your theme as the default_head_blocks.xml includes these lines:

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

In your theme file (eg. app/design/frontend/{vendor}/{theme-name}/Magento_Theme/layout/default_head_blocks.xml) you can remove the references to the files using:

<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"/>
<remove src="fonts/Luma-Icons.woff2"/>
1
  • this doesn't really remove it as you end up having it included in styles-m.css for some reason. I'm still looking at why it's not being removed. Commented Aug 10, 2021 at 20:01
1

Step1: Copy the _typography.less from location

vendor\magento\theme-frontend-blank\web\css\source

paste to location

app\design\frontend\vendor\theme-name\web\css\source.

Remove the lines that refer to the opensans fonts.

Step2: Run the following commands from root of magento directory

rm -rf pub/static/*

php bin/magento setup:static-content:deploy -f
0

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.