Supports both HTML being passed as the first argument to the inliner function (through various detection), but also on the CLI supports HTML being piped, via `cat foo | inliner`.
Fixes#66Closes#73
Fixes#58
Compresses inline SVG using SVGO, and compresses CSS background SVG images by making them data URLs (using text/svg+xml mime).
Adds CLI (and lib) option: --nosvg which avoids using SVGO for compression (as it can on occassion mess up).
Also includes a refactor of the code to organise the files a little better (allowing for further inlined elements to be added).
Fixes#26
Inliner was trying to resolve and request `data:` urls. Now it checks to see if it's already inlined.
I also updated the whole `.get` method to make smarter use of the caching. Originally the cache is only populated when the request has completed, but if the same image is on the page 20 times, the request would be made 20 times. Now, we cache the promise, so the request is only placed once, and returns a re-usable promise if it's already in progress or resolved.
The options parameter { encoding: 'binary' } set in image.js was lost.
It was not used in the main get() function and was not passed the function in get.js.
minimist was eating the args after the flags, like `inliner -d <url>` was becoming `debug=<url>`, so I've added my own simple implementation that works well enough.