Page MenuHomePhabricator

Document how mediawiki.skin.variables works
Closed, DuplicatePublic

Description

Follows-up T112747: Devise a generic way for theme-agnostic stylesheets to adapt to the current theme

In https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/633828 an attempt is made to define a variable inside mediawiki.skin.variables.less that does not (yet) exist in core. The goal of this patch is to allow skins like Vector to access the variable after importing mediawiki.skin.variables.

This unexpectedly and unintuitively (at least to me) lead to a Jenkin phpunit test failure which may suggest a problem in the existing implementation.

I am not sure if this is the appropriate behaviour as I couldn't find any documentation on this ResourceLoader feature on mediawiki.org however my revised patch passed when I also added the variable to core (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/635046). I am now left a little confused.

Given the specialized knowledge required for understanding ResourceLoader and the few people's heads that knowledge is in we should prioritize documenting this feature better before we use it more widely.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

What was the failure? (build logs will or have expired soon) What did you do to make it work?

Failure in core test file:

0 1) ResourcesTest::testResourceFiles
13:46:00 Less_Exception_Compiler: variable @padding-content-body-top is undefined in file /workspace/src/skins/Vector/resources/skins.vector.styles/layout-max-width.less in layout-max-width.less on line 22, column 20

The question I guess I'm asking is this: Can a skin define a skin variable that is not itself defined in core? If not, how should skins share variables via skin variables that are specific to themselves (e.g. exposed in skin styles in some way).

In short:
No and no!

These files are only meant for global skin variables shared by all skins, not skin specific variables. Skin specific values yes.
If a skin wants to define specific values, and they are not of MediaWiki's concern, it should do it in files to separate concerns.

Krinkle triaged this task as Medium priority.
Krinkle moved this task from Inbox to Accepted Enhancement on the MediaWiki-ResourceLoader board.
Krinkle subscribed.

Handing to Volker for a first pass. I've got time this quarter to review and help answer any questions.

@Volker_E: Removing task assignee as this open task has been assigned for more than two years - See the email sent to task assignee on Feburary 22nd, 2023.
Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome! :)
If this task has been resolved in the meantime, or should not be worked on by anybody ("declined"), please update its task status via "Add Action… 🡒 Change Status".
Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator. Thanks!

Catrope subscribed.

Putting this in DST requests for now, so that we can consider documenting this (some time after the upcoming 1.0 release, as this documentation is for skin authors, not for consumers of the skin variables)