Search code examples
mediawikimediawiki-templates

Add Google Fonts to a MediaWiki skin


I need to know the recommended way to add a Google font to a MediaWiki skin. I know I can use Common.css and I know there might be extensions to meet the need, but as I am developing a skin I want to add the necessary fonts with the skin.

I do not want to use any extensions to achieve the goal, unless using a extension is the recommended way.


Solution

  • I know I can add fonts to a css/ less file but as the css and js are loaded via resource leader in Mediawiki, so I wanted to know if there is any specific rules to add Google Fonts/ externally hosted fonts.

    But I found that there is no specific guideline for fonts, I can add fonts like the following,

    @import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300&display=swap');