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
    copy the file in your theme and change it how you want – Marius Jan 9 '19 at 8:30
2

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"/>
| improve this answer | |
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
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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