Commit Graph

67 Commits

Author SHA1 Message Date
Rémi Emonet
1ef4ad8089 test: check and update failing url()-related tests 2017-08-25 22:01:04 +01:00
Rémi Emonet
bf70e131be test: svg background also in a style attribute 2017-08-25 22:01:04 +01:00
Rémi Emonet
f0faa68730 test: trickier circle.svg to test escaping 2017-08-25 22:01:04 +01:00
positronium
c3cbdf0346 fix: spaces in file names
Fixes inlining local files with spaces in names.
Fixes #148.
2017-06-25 22:57:30 +01:00
Ildar Sagdejev
5786954e07 fix: Remove redundant trailing comma after inlined CSS @import
Fixes #142
2017-05-20 11:04:25 +01:00
Remy Sharp
64d218bb18 test: fix broken test plan & use glitch>now 2017-05-19 15:11:40 +01:00
Remy Sharp
20a5bcbfb0 test: remove version test 2017-04-27 19:19:51 +01:00
Remy Sharp
40845eeb3a chore: Merge branch 'master' of github.com:remy/inliner
* 'master' of github.com:remy/inliner:
  fix: don't corrupt whitespace in scripts
2017-04-05 10:58:14 +01:00
Remy Sharp
e9c0258a36 chore: pushing missing file 2017-04-05 10:57:37 +01:00
Remy Sharp
552851733c fix: don't corrupt whitespace in scripts
Fixes #120
2017-04-05 10:56:14 +01:00
John Ericson
83edb2bf54 feat: add iesafe option
Fixes #134
2017-04-05 09:10:46 +01:00
makoto tsuyuki
ef5433ccc7 feat: consider external end import css charset 2017-03-28 06:11:35 +01:00
makoto tsuyuki
b87a34d592 fix: uglify-js 2.8.0 changes output. 2017-03-28 06:11:35 +01:00
makoto tsuyuki
3fa5f7ea67 fix: spaceless @import cause infinite loop (#136) 2017-02-28 07:15:22 +00:00
Pierre Reimertz
a41ab78a95 feat: added preserveComments option 2016-12-31 16:34:27 +00:00
Joey Parrish
d53c651921 fix: detection of absolute URLs
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
2016-11-17 11:20:13 -08:00
Joey Parrish
68c345ae8e feat: inline favicons with rel="shortcut icon"
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
2016-11-17 11:19:59 -08:00
Remy Sharp
109555f690 fix: don't encode by default
Fixes #109
2016-08-09 22:05:33 +01:00
Remy Sharp
c085114ebf fix: ensure svg viewBox is kept
Fixes #102

Use lowerCaseAttributeNames=false when SVG present
2016-07-31 15:38:27 +01:00
Remy Sharp
0772d51069 fix: don't bail on corrupted URLs
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).
2016-07-31 15:38:27 +01:00
Remy Sharp
0ae1301641 fix: don't remove SSI
Fixes #110
2016-07-31 15:38:26 +01:00
Cade Scroggins
701bf13678 fix: don't inline background images when the images option is false
also includes tests
2016-07-31 15:38:26 +01:00
Mikael Finstad
a2869fc81a fix: non-ascii characters
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
2016-07-31 15:38:26 +01:00
Remy Sharp
ae44accdd0 tests: update for new parsing 2016-05-22 22:27:10 +01:00
Remy Sharp
734dafb136 fix: headers use colons
The headers option was supposed to mirror cURL, but they were wrongly splitting on `=` and not `:`. This fix updates.
2016-05-22 22:25:50 +01:00
Remy Sharp
253a3173cd fix: wrap all CSS data urls in quotes
This ensures that if SVG is used as a background, it doesn't get corrupted.

Fixes #97
Fixes #96
2016-05-22 14:45:52 +01:00
Shin'ya Ueoka
925c99e2c3 fix: detect xml-mode with XML declaration 2016-05-17 22:36:54 +09:00
Remy Sharp
0ddff8886f fix: local content should use fs for inlining
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
2016-04-20 21:42:48 +01:00
Remy Sharp
731e7e9351 chore: merge branch 'feature/local-only'
* '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
2016-04-19 11:19:50 +01:00
Eugene Park
825ec601dc chore: renamed flag to --skip-absolute-urls 2016-04-06 08:02:46 +00:00
Remy Sharp
c0a632b24b test: improve coverage 2016-02-28 09:51:10 +00:00
Remy Sharp
51f0ca07ba fix: support favicons
Fixes #87
2016-02-28 09:50:05 +00:00
Eugene Park
15e6b0dab6 chore: renamed flag to --same-origin-only 2016-02-20 23:59:30 +00:00
Eugene Park
353a2a92cb feat: support for only inlining local files 2016-02-20 10:45:46 +00:00
Remy Sharp
7c33ee7d23 chore: merge branch 'feature/headers' 2016-01-18 22:15:34 +00:00
Remy Sharp
4ed1b39529 feat: support custom headers
Via cli using `-H user-agent="inliner custom"`

Fixes #69
Closes #59
2016-01-18 22:12:52 +00:00
Remy Sharp
0ea78f662d test: check for meta http-equiv 2016-01-18 21:04:31 +00:00
Remy Sharp
c6073e9e0a test: add meta-data stripping test 2016-01-18 20:54:44 +00:00
Stu Cox
6c9bba2adb feat: add support for inlining assets in style attributes
Fixes #65
2016-01-18 11:49:48 +00:00
Remy Sharp
5d7c439d92 test: don't touch non-script scripts 2015-11-26 19:49:31 +00:00
Ricardo Pescuma Domenecci
e32fc0abc7 test: added tests for inlinemin and nocompress js 2015-11-26 10:29:27 +00:00
dotob
82fb14c11f fix: strip img query string from local files
When ? was left in url and parsing a local file.

Fixes #72
2015-11-26 10:28:43 +00:00
Remy Sharp
6e46680fbd feat: support plain HTML as a source
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 #66
Closes #73
2015-11-26 10:24:12 +00:00
Felix Akkermans
cbcd398182 fix: resolving already resolved HTTP links in file
Also includes tests
2015-11-26 10:24:12 +00:00
Hubert SABLONNIÈRE
747836d3e0 feat: inline video (and their poster image attribute)
Video (and their poster) inlining is disabled by default.
It sounds crazy but for videos with a "reasonable length", it works just fine.
2015-09-22 00:59:22 +02:00
Sam Nguyen
8af810faa7 fix: replace with empty string if error in GET
Fixes #61

It seems to work, but I'm not sure if it's a clean way of doing it. Let
me know what you think @remy.
2015-08-28 20:20:52 -07:00
Remy Sharp
9904b6b334 feat: compress SVG using SVGO
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).
2015-08-26 22:43:40 +01:00
Remy Sharp
bf1860271f feat: detect encoding
Using charset and jschardet allows us to detect the encoding, whilst still supporting allowing the user to override.

Technique via: http://stackoverflow.com/questions/12326688/node-js-scrape-encoding/18712021#18712021

Fixes #60
2015-08-23 22:43:14 +01:00
Manolis Stamatogiannakis
cf68995f03 test: add tests for specifying encoding 2015-08-23 22:43:02 +01:00
Remy Sharp
c439d79f5a fix: handles already inlined content
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.
2015-07-30 23:55:00 +01:00