MediaWiki talk:Gadget-enwp-boxes.css

About this board

How/Why should we use templatestyles?

4
Pols12 (talkcontribs)

Hello @Izno, @TheDJ,

I come from Meta-Wiki because I would like to request a small top and bottom margin (0.5em) for amboxes.

However, I see we should use templatestyles instead of this style sheet.

I think using import was to avoid code duplicates and so facilitate the maintenance. Why should we change this pattern? Can’t we use @import from templatestyles to combinate both solutions?

Izno (talkcontribs)
  1. TemplateStyles cannot @import so far as I know.
  2. From what I can tell, this @importing to other wikis does not actually facilitate maintenance. You must update the local template/module regardless if/when those should change in one place or the other.
  3. Anyway, one of the design points of amboxes is *not* to have top/bottom margin. (Perhaps this is another reason to finally have your own copy.)
  4. For more general reasons to use TemplateStyles, see Extension:TemplateStyles and en:MediaWiki talk:Common.css/to do#description.
Pols12 (talkcontribs)

OK, thank you. I thought there was a hack to import CSS styles in TemplateStyles.

Tacsipacsi (talkcontribs)

Since anyone can edit TemplateStyles subpages (in contrast to normal CSS pages like this one, which are constrained to interface admins), there are strict restrictions on what they can contain. @import is not disabled, just restricted: it can import only URLs that match one of the regexes in the $wgTemplateStylesAllowedUrls['css'] array—which is the empty array by default (and, as far as I see, in Wikimedia production as well). So no hack is needed, @import is supported, just disabled. (And since it’s intentionally disabled, we shouldn’t try to work this restriction around. The clean way would be a configuration change request, where the system administrators have the option to do it or deny it. However, as Izno wrote, @importing the CSS doesn’t solve the maintenance issue; in contrast, it just makes it more likely that a change applied to both the wikicode and the CSS here on mediawiki.org will break other wikis, which load the new CSS from mediawiki.org and apply it to the old, locally generated wikicode. Using TemplateStyles and copying the CSS around as well makes sure that the two stay in sync.)

Reply to "How/Why should we use templatestyles?"
There are no older topics