MediaWiki talk:Gadget-site.css

Code direction
Hello. Codes in rtl languages like Persian are broken because the right-to-left structure is applied to them. By adding this command, you can prevent the codes from being right-aligned so that their readability is not lost: pre, code { direction: ltr } Thanks. Alireza Ivaz (talk) 07:35, 10 September 2020 (UTC)
 * The above code won’t work. ResourceLoader “helps” by flipping directions in right-to-left languages, so the above code will be transformed into  if the user interface language is RTL. This function can be disabled, luckily:   —Tacsipacsi (talk) 11:27, 13 September 2020 (UTC)

Last to TemplateStyles: mbox and MediaWiki:Gadget-enwp-boxes.css
Just starting a section here for working space. I can see they've been split on template lines to templatestyles but these really should be loaded from Module:Message box. Just need to sort out... how? What the actual split should be for the generic styles? Izno (talk) 23:22, 7 July 2021 (UTC)


 * I’ve already done some work on this on the Meta&#x2011;Wiki, in the order of loading:
 * m:Template:Mbox/styles.cssUsed by all Message Box templates.
 * m:Template: [A|C|F|I|O|T] mbox/styles.cssUsed by the relevant Message Box subclass.
 * m:Template:Mbox/small.css (also in: Template:Mbox/small.css)Used when small is set to a truthy value.
 * Note that these aren’t currently used outside of my userpage, which is so that the “m:User:ExE Boss/OtherProjects” box displays correctly on wikis that don’t include MediaWiki:Gadget-enwp-boxes.css in their MediaWiki:Common.css. — ExE Boss 01:30, 8 July 2021 (UTC)
 * Yeah, splitting Mbox and small to separate sheets isn't great because to get the ambox negative margin rules to work is a PITA in conjunction with per-ambox TStyles. My inclination is to add those to each of the kinds of box sheets, which are mostly used mutually exclusively to a specific page/namespace (i.e. we won't be loading multiple of the same styles regardless, even if there were a lot of styles to duplicate).
 * The only interaction I don't really understand is ombox. Izno (talk) 16:30, 9 July 2021 (UTC)
 * Secondly, these should definitely be loaded via the module and should have names like so, like perhaps Module:Message box/ambox.css. Izno (talk) 16:31, 9 July 2021 (UTC)
 * In that case, how about:  — ExE Boss  13:40, 10 July 2021 (UTC)
 * Right, I really don't think or want in reality to have the base styles separate from each of the per-namespace pages. As I said, the ambox ".ambox + .ambox" rule is a PITA to have to deal with when you have TemplateStyles (see what I had to do for Module:Navbox/styles.css). While none of the others have it, that becomes enough to just say 'have the per-namespace styles' with the duplication and then go from there.
 * I also have a mind to making the names nice for the abusefilter on Wikidata which prevents the creation of items for styles pages, which requires pagenames like "/styles.css", so not sure if there's a nice way to fit that into things. Probably not.... Izno (talk) 02:14, 11 July 2021 (UTC)
 * "Fake" subpages like Module:Message box/ambox/styles.css maybe.... Izno (talk) 02:16, 11 July 2021 (UTC)
 * I’d rather avoid “fake” subpages. Also note that Module:Message box/core.css needs to exist in order for all of to override the default  styles when multiple   types are used in a single page (e.g:  from a MediaWiki: message, and   from the current page, because otherwise the  styles would be overriden by the duplicated  styles). That said, I agree that the  should probably be moved into Module:Message box/ambox.css (and any other *mbox.css that supports true) — ExE Boss  15:30, 15 July 2021 (UTC)

The point is that core.css and mbox-small don't need to exist as separate sheets; you just roll in the styles to the specific stylesheets and then add a .Xmbox to the front of each selector. It's a duplication but gets us down to one sheet each, and the duplication is minimal since we do not anticipate (generally) having multiple template types per page.

Ambox example (uninteresting styles elided): becomes: These styles were as compressed with 'core' styles as they are solely because they're applied globally, but we can be a little more wasteful given that there are usually at most 2 types per page and more commonly 1 (and it reduces the count of selectors anyway, which are slightly expensive for the hidden .mw-parser-output).

The other thing to consider is getting this from presentation tables to flexy divs, but I haven't spent a lot of time yet thinking through the implications of neighboring floats and getting the images not to shrink to oblivion (which I know the solution to but it requires hardish-coded min-widths/flex basis).

--Izno (talk) 17:53, 15 July 2021 (UTC)
 * I’ve now converted all of ambox.css, cmbox.css, imbox.css, ombox.css, and tmbox.css to use what you’ve suggested. All that’s left now is to move Template:Fmbox/styles.css to Module:Message box/fmbox.css and apply Special:Diff/4705697 to Module:Message box, which will both need to be done by an admin. Also note that MediaWiki:Gadget-enwp-boxes.css is used by other wikis using Web/CSS/@import, so it can’t be deleted. — ExE Boss 19:50, 15 July 2021 (UTC)
 * It can be uninstalled. That said, other wikis shouldn't be importing that file because there is a potential for that file to change when the module changes (in the general), and certainly they'll need to keep their own copy of the CSS from when they migrate to TemplateStyles.
 * I see missing styles in ambox.css e.g. the margins. I'm not sure what you copied from. Izno (talk) 23:07, 15 July 2021 (UTC)
 * I copied from MediaWiki:Gadget-enwp-boxes.css, but I missed that the rule that already was in Module:Message box/ambox.css when I moved it only had the  and  properties. — ExE Boss  23:45, 15 July 2021 (UTC)