If a URL is resolved before checking for absolute URLs, even relative
URLs will be detected as absolute.
Includes updates to the skip-absolute-urls test.
Closes#126
If the page is using rel="shortcut icon" instead of rel="icon", the
author will be surprised that the icon was not inlined, and may not
notice. It would be better to inline that icon.
Includes updates to the favicon tests.
Related to issue #126
Fixes#104
It will warn about them, but not fail the job, instead replacing the URL with '' (which is just as bad as the corrupted url, but at least it finishes).
When doing a request with the node request module with an URL
containing UTF-8 chars, some webservers will fail to find the file.
Therefore encodeURI on the url before requesting it.
Not sure if this is the best way to test it, but it works with all test cases.
Example of page which doesn't inline properly:
http://hotpoticeland.com/holsgerdislaug/
which links to the image:
http://hotpoticeland.com/wp-content/uploads/Hólsgerðislaug-300x225.jpg
The issue here was that although the "simple" detection was in place if the URL looked like HTML (i.e. has an angle bracket in it), but it didn't ever set the `isFile` flag.
This fix corrects this, but also swallows ENOENT errors, to mirror >=400 response codes being swallowed (i.e. return an empty body).
Fixes#89
* 'feature/local-only' of https://github.com/eigenuser/inliner:
chore: renamed flag to --skip-absolute-urls
chore: renamed flag to --same-origin-only
feat: support for only inlining local files
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.