mirror of
https://github.com/remy/inliner.git
synced 2024-08-16 20:00:35 +03:00
fix: don't inline background images when the images option is false
also includes tests
This commit is contained in:
parent
a2869fc81a
commit
701bf13678
@ -11,6 +11,11 @@ var parse = require('path').parse;
|
||||
|
||||
function getImages(root, css) {
|
||||
var inliner = this;
|
||||
|
||||
if (inliner.options.images === false) {
|
||||
return css;
|
||||
}
|
||||
|
||||
var singleURLMatch = /url\(\s*(['"]*)(?!['"]*data:)(.*?)(['"]*)\s*\)/;
|
||||
var matches = css.match(match) || [];
|
||||
var images = matches.map(function eachURL(url) {
|
||||
|
3
test/fixtures/bg-img-no-inline.opts.json
vendored
Normal file
3
test/fixtures/bg-img-no-inline.opts.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"images": false
|
||||
}
|
1
test/fixtures/bg-img-no-inline.result.html
vendored
Normal file
1
test/fixtures/bg-img-no-inline.result.html
vendored
Normal file
@ -0,0 +1 @@
|
||||
<!doctype html> <meta name="charset" content="utf-8"> <style> body{ background-image:url('./image.jpg');}</style>
|
7
test/fixtures/bg-img-no-inline.src.html
vendored
Normal file
7
test/fixtures/bg-img-no-inline.src.html
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<!doctype html>
|
||||
<meta name="charset" content="utf-8">
|
||||
<style>
|
||||
body {
|
||||
background-image: url('./image.jpg');
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user