joakin / loot-ui

Frontend server for rendering an experimental version of Wikipedia
2 stars 1 forks source link

Conditionally gallery styles not loaded #38

Open jdlrobson opened 8 years ago

jdlrobson commented 8 years ago

Styles for galleries are not loaded in the full version of https://reading-web-research.wmflabs.org/wiki/Louis_Choris (compare with https://en.m.wikipedia.org/wiki/Louis_Choris#Gallery) and they are only needed on a handful of pages

Would be interesting to explore if there is a way to pull down these styles when needed rather than replicate them ourselves...

jdlrobson commented 8 years ago

Note information about this is contained in the response within the stylesheet. Would be great if this was more semantic.

<link rel="stylesheet" href="//en.wikipedia.org/w/load.php?    modules=mediawiki.legacy.commonPrint,shared|mediawiki.skinning.elements|mediawiki.skinning.content|mediawiki.skinning.interface|skins.vector.styles|site|mediawiki.skinning.content.parsoid|ext.cite.style|mediawiki.page.gallery.styles|mediawiki.raggett&amp;only=styles&amp;skin=vector"/>
joakin commented 8 years ago

Yeah... Styles are an issue. We're running a small subset of them right now, because all of them are very complected and a mess to understand what and where.

What we would need is just the list of modules for laying out the article content, and not for styling the whole page as mediawiki. Right now there is now way of knowing that...

If we had smaller layout focused stylesheets defined on the restbase output we could do something like insert the styles on the page per article, and let SW cache them.

Another option could be bundling article styles into ours at compile time. Fetch them from URLs, extract them into their own CSS file, load it on demand when on article page and have service worker pre-cache it.

I hesitated about that ^ option because of the sheer amount of CSS that takes over the whole page (size, and messing with the app's styles). If taking that approach, we would have to figure out how to load those styles into the page without messing with the application styles.

So complex... But yeah, let's keep talking about it.