Page MenuHomePhabricator

Import or encode CSS URLs
Open, Needs TriagePublic

Description

If a CSS element uses a URL, it will not work in the export if the device doesn't support URL loading or the device is offline.

TemplateStyles allows the use of images from Commons, but not base64 encoded images. Inline CSS can't use any URLs.

It's not common to use such a rule with a URL in it, but it can produce things that templates can't easily: An example of such a CSS rule: https://en.wikisource.org/wiki/Newes_from_the_Dead, which was kind of a proof-of-concept:

border-image-source:url("https://upload.wikimedia.org/wikipedia/commons/6/66/Newes_From_the_Dead_-_Title_page_CSS_border.png");
border-image-slice:200 200;
border-image-width:50px;
border-image-repeat:round;

If WS-export could rewrite such a CSS rule, it could be made to work in export. I think there are two options:

  • Copy the file into the export and rewrite the URL to point to that, rather than the commons file.
  • Encode the file as base64 directly in the CSS

Related Objects