0

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.

nasirkhan
  • 9,948
  • 5
  • 27
  • 33

2 Answers2

1

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');
nasirkhan
  • 9,948
  • 5
  • 27
  • 33
0

Your skin is likely to have a CSS stylesheet as described in the docs:

    "ResourceModules": {
        "skins.foobar": {
                "styles": {
                        "resources/screen.css": { "media": "screen" },
                        "resources/print.css": { "media": "print" }
                }
        }
    },

So you can embed the Google font in resources/screen.css with @font-face (example).

Alexander Mashin
  • 3,892
  • 1
  • 9
  • 15
  • I found that we can add fonts to css files and there is specific recommendation for fonts. thanks for your reply. The doc you referred is outdated. For building skins for MediaWiki one should follow this page: https://www.mediawiki.org/wiki/Manual:How_to_make_a_MediaWiki_skin – nasirkhan Jul 09 '21 at 14:27