Page MenuHomePhabricator

Allow modularization of site stylesheets (MediaWiki:Common.css etc.)
Closed, DeclinedPublic


Common.css and Mobile.css often use the same CSS rules. But it takes some effort to simultaneously maintain both style sheets. It seems better to move parts of these style sheets to modules/snippets and incorporate them to the main style sheets like templates. A special syntax is needed to do this. Incorporation should not be done by @import url() rules.

Event Timeline

matmarex renamed this task from Modularization of Mediawiki stylesheets to Allow modularization of site stylesheets (MediaWiki:Common.css etc.).Sep 29 2016, 8:00 PM
matmarex edited projects, added MediaWiki-General; removed MediaWiki-User-Interface.
matmarex updated the task description. (Show Details)
jhobs added subscribers: Jdlrobson, jhobs.

The proper solution to this problem would probably be to graduate any common styles between Common.css and Mobile.css that are seen as essential to all wikis into MediaWiki Core. We can either rewrite this task for said purpose or continue handling this on-wiki.

@Jdlrobson do we include Common.css on the mobile skin? If not, that could be another solution (included Common.css on mobile, remove any duplicate styles from Mobile.css, and start overwriting Common.css where necessary). Please add MobileFrontend back to the task if this is something we'd want to consider doing (if we aren't already).

I guess this falls into the ResourceLoader category. To achieve this we could add LESS support or @import url support.

We may not need @import support. I'm not 100% sure, but I believe this can already be done by using a custom gadget instead of the built-in site module.

For example:

* site-styles[ResourceLoader|default|targets=desktop]|site-common.css
* site-styles-mobile[ResourceLoader|default|targets=mobile|skins=minerva]|site-common.css|site-mobile.css