Commit Graph

28 Commits

Author SHA1 Message Date
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
Remy Sharp
54aae10c43 chore: merge master
Merge branch 'collapse-whitespace' of https://github.com/hsablonniere/inliner into hsablonniere-collapse-whitespace
2015-07-29 15:36:30 +01:00
Hubert SABLONNIÈRE
fae14c92c3 fix: keep whitespaces and newlines in pre and textareas 2015-07-29 15:03:15 +02:00
Hubert SABLONNIÈRE
32dfd8ce02 fix: encode binaries properly when requested via HTTP
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.
2015-07-29 14:30:36 +02:00
Hubert SABLONNIÈRE
e20c0bd7bd fix: inline scripts containing ETAGO properly
The fix is done by escaping all "</script" to "<\/script" according to Mathias Bynens article :
https://mathiasbynens.be/notes/etago
2015-07-29 03:05:06 +02:00
Hubert SABLONNIÈRE
214f698f95 fix: prevent signs like "<" or ">" to be treated as HTML in styles 2015-07-28 17:47:45 +02:00
Hubert SABLONNIÈRE
4e7acd39bb fix: prevent signs like "<" or ">" to be treated as HTML in scripts 2015-07-28 17:36:00 +02:00
Remy Sharp
593a2749cf fix: file based scripts
Parser was getting a buffer, so it needed to be coersed to a string.

Fixes #52
2015-07-28 14:49:10 +01:00
Remy Sharp
0590ce4a3b chore: merge master 2015-07-28 14:43:40 +01:00
Guillaume Girou
f89ed538f5 test: local js script not minified
Fail to uglify local js script with TypeError: undefined is not a function
2015-07-28 15:24:17 +02:00
Remy Sharp
aace364794 test: put jscs as part of tests
Because, yes, I'd like a consistent code style!
2015-07-28 13:40:09 +01:00
Remy Sharp
c8e4cab6ca test: simplify assets in tests 2015-07-28 10:48:29 +01:00
Remy Sharp
348f8a3199 test: include external import test
And contributing file for others to see how to file issues
2015-07-28 10:21:18 +01:00
Remy Sharp
06c8132aa3 fix: minified scripts being removed
Also add test
2015-07-28 07:12:46 +01:00
Remy Sharp
6653796461 test: add full tests 2015-07-27 22:13:21 +01:00
Remy Sharp
743018c1a0 feat: scripts and compression 2015-07-27 16:00:56 +01:00
Remy Sharp
96ac1b7ac8 fix: background images in CSS 2015-07-27 14:54:46 +01:00
Remy Sharp
d6d13c83e4 fix: use own cli parser
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.
2015-07-27 13:22:12 +01:00