html-inliner

Last updated: 2018-05-21 17:00:22 +0100

Upstream URL: git clone http://chriswarbo.net/git/html-inliner.git

Repo

View repository

View issue tracker

Contents of README follows


HTML Inliner

This script reads HTML data from stdin and writes it to stdout.

It looks for <code>script</code> elements with a <code>src</code> attribute; and <code>link</code> elements with <code>type="text/css"</code>, <code>rel="stylesheet"</code> and a <code>href</code> attribute.

The <code>src</code> and <code>href</code> URLs are resolved (relative to <code>BASE_URL</code> env var, if given), and their contents fetched. This content is encoded as Base64 and put in a data URI in place of the original URL.

Areas for improvement:

<ul> <li>URL handling/resolving</li> <li>Better MIME handling (we assume all scripts are <code>text/javascript</code> and all CSS is <code>text/css</code>)</li> <li>Support for inlining <code>img</code> elements.</li> </ul>