Page MenuHomePhabricator

Avoid ResourceLoaderGetLessVars hook in MinervaNeue
Closed, ResolvedPublic

Description

Minerva currently uses this hook to expose the $wgMinervaApplyKnownTemplateHacks config variable to the skins.minerva.tablet.styles and skins.minerva.content.styles stylesheet modules.

This should instead use the getLessVars module method instead of the global ResourceLoaderGetLessVars hook.

Looking closer at the specific use case here, it seems to mainly be used as a boolean flag to include an additional less file. It might be more convenient to do this at the module definition level instead. E.g. the module can be defined a number of different files in the styles array and then one of them is only added based on the config var. (E.g. instead of using 1 less file as entry point that imports 5 others, specify the 4-5 files directly).

I can see why you might prefer to keep the logic in Less, so the getLessVars module method works too.

Related: T66578

Event Timeline

It's worth pointing out that $wgMinervaApplyKnownTemplateHacks will be removed as soon as TemplateStyles is enabled everywhere and we have a migration path to migrate these styles to the wikis.

Change 423581 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/skins/MinervaNeue@master] Convert custom LESS var from global to local

https://gerrit.wikimedia.org/r/423581

Change 423581 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Convert custom LESS var from global to local

https://gerrit.wikimedia.org/r/423581