fix: don't inline background images when the images option is false

also includes tests
This commit is contained in:
Cade Scroggins 2016-07-03 10:22:13 -07:00 committed by Remy Sharp
parent a2869fc81a
commit 701bf13678
4 changed files with 16 additions and 0 deletions

View File

@ -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) {

View File

@ -0,0 +1,3 @@
{
"images": false
}

View File

@ -0,0 +1 @@
<!doctype html> <meta name="charset" content="utf-8"> <style> body{ background-image:url('./image.jpg');}</style>

View File

@ -0,0 +1,7 @@
<!doctype html>
<meta name="charset" content="utf-8">
<style>
body {
background-image: url('./image.jpg');
}
</style>