Manual:$wgMFCustomSiteModules
Appearance
| MediaWiki settings: $wgMFCustomSiteModules | |
|---|---|
| Makes MobileFrontend use MediaWiki:Common.css for mobile site |
|
| Introduced in version: | 1.41.0 (Gerrit change 910891; git #fa76c7b3) |
| Removed in version: | Still in use |
| Allowed values: | (boolean) |
| Default value: | false |
| Other settings: Alphabetical | By function | |
Rough load order
[edit]You will need to familiarize yourself with these pages:
- MediaWiki:Mobile.css and MediaWiki:Mobile.js
- MediaWiki:Common.css, MediaWiki:Common.js, and MediaWiki:Print.css
- MediaWiki:Minerva.css and potentially MediaWiki:Minerva.js (or MediaWiki:Skinname.css for the skin name set in
$wgDefaultMobileSkinand the same with .js)
Load order on mobile when this config is set to true:
- Top loaded (before the content loads): MediaWiki:Minerva.css
- Bottom loaded (after the content loads): MediaWiki:Mobile.css, MediaWiki:Mobile.js, MediaWiki:Minerva.js
Load order on mobile when this config is set to false:
- Top loaded: MediaWiki:Common.css, MediaWiki:Minerva.css, MediaWiki:Print.css (in this order)
- Bottom loaded: MediaWiki:Common.js, MediaWiki:Minerva.js
Checklist to move from true to false
[edit]Enabling this feature can lead to degradation in mobile performance. This page provides a checklist of what is expected on WMF wikis from interface admins before toggling the switch.
Before and after the change it is recommended that you measure frontend performance.
Preparation steps
[edit]- If your site has an empty MediaWiki:Common.css, MediaWiki:Print.css and MediaWiki:Common.js you can enable this config flag and skip further steps.
- Read wikitech:MediaWiki Engineering/Guides/Frontend performance practices
- Review for uses of
.skin-<skinname>that occur in either MediaWiki:Common.css, MediaWiki:Print.css and MediaWiki:Common.js to see if they need to be in those pages. Move them to the relevant skin CSS if not, e.g., MediaWiki:Vector-2022.css. - Ensure that MediaWiki:Mobile.js and MediaWiki:Common.js is identical. This allows us to confirm that the switchover will not introduce any JavaScript errors post-launch.
- Confirm that there are no visible cumulative layout shifts on mobile view.
- Make sure MediaWiki:Mobile.css is empty. Migrate essential CSS from MediaWiki:Mobile.css to MediaWiki:Minerva.css and/or gadgets. MediaWiki:Minerva.css is already render blocking so this is an important step to allow us to compare before and after. Note, this may lead to some temporary duplication in MediaWiki:Common.css and that is okay.
- Verify the CSS in Common.css is mobile-friendly. Check specifically for:
- floats
- margins
- clear
- display: flex/grid
- Compare CSS and JS payload size for mobile and desktop sites (both compressed and uncompressed). This can be done in the developer console for your browser by reviewing the network tab. Compare the desktop site with Minerva disabled with the mobile site. These should be near identical.
- If uncompressed is similar but compressed is higher that is typically where Common.css and Minerva.css duplicate CSS and can be addressed post-configuration change.
- Ensure render blocking CSS is <3kb (compressed) and < 7kb (uncompressed) at
/w/load.php?modules=site.styles&only=styles&skin=minerva- If it is larger please move styles from MediaWiki:Common.css to templatestyles where possible.
How to check compression size
[edit]In Bash or a similar shell, run
# compressed
curl -s -H "Accept-Encoding: gzip" "https://en.wikipedia.org/w/load.php?modules=site.styles&only=styles&skin=minerva" --output - | wc -c
# uncompressed
curl -s "https://en.wikipedia.org/w/load.php?modules=site.styles&only=styles&skin=minerva" --output - | wc -c
Post configuration
[edit]- Please ensure once your site has been configured to use MediaWiki:Common.css that you remove redundancy.
- You can delete MediaWiki:Mobile.css and MediaWiki:Mobile.js safely.
- If you have user rights, please review Google Web Vitals for the site property and any relevant dashboards to ensure that there has been no noticeable degradation.