Page MenuHomePhabricator

Don't link to empty css
Closed, ResolvedPublic


A default mediawiki install will link with every page load up to four 'empty' php-generated css files (Common.css, Print.css, skin.css, User/skin.css), plus a fifth (Handheld.css) disabled behind $wgHandheldStyle.

While small and easily cacheable, they produce a innecessary request on first visit and rendering lag.
The attached patch skip -at the cost of a regex (compiled once, executed three times)- linking to the three that are already in the message cache.

Unless the extra db query discourage it I'd also skip non-existant pages for the user css subpages.

Users viewing cached pages won't view the changes immediatly once the css is created, which is similar to the existing situation where the css page will be cached. If there's a caching proxy, pages served from it previous to the page creation won't serve the css. If it's really needed to show it immediatly, the sysadmin could purge its cache or add a configuration option, but I don't think such case would be common enough to make that necessary.

Version: 1.16.x
Severity: enhancement



Related Objects


Event Timeline

bzimport raised the priority of this task from to Normal.Nov 21 2014, 10:42 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz19995.
bzimport added a subscriber: Unknown Object (MLST).



brion added a comment.Jul 30 2009, 4:51 PM


I wonder if it's better to just consolidate them. Michael, can this already be done with script-loader goodies?

mdale wrote:

I never got around to merging in the style sheet grouper. Its a bit complicated since there are conditional includes (print css, IE css etc) and the paths to images have to be rewritten... and it hurts catch-ability to group everything for every context. Ie you have a base style sheet and that is cached it sucks to get a new file that includes that main style sheet when your on a different page.

But there issues can be overcome. (we do separate requests for "core" scripts and page specific scripts with the script loader javascript for example)

I don't have a good sense if this is high priority though. Probably would not take too long... I will put it on my medium priority todo list ... unless its critical for deployment; then I will put it on high priority ;)

brion added a comment.Jul 30 2009, 6:28 PM

Not supercritical, though it doesn't hurt to trim unnecessary reqs. :)

demon added a comment.Sep 1 2010, 2:05 PM

Pinging this again.

Roan, is this being taken care of in the resourceloader branch?

Empty user javscripts are not linked since r68065

Reedy added a comment.Sep 1 2010, 10:16 PM

<RoanKattouw> Reedy: Empty CSS? Well it gets combined, you know, so it doesn't matter

Fixed in ResourceLoader by combining CSS files.