diff --git a/src/replace.js b/src/replace.js index 30778a3..6e27c02 100644 --- a/src/replace.js +++ b/src/replace.js @@ -129,9 +129,11 @@ EPUBJS.replace.cssUrls = function(_store, base, text){ matches.forEach(function(str){ var full = EPUBJS.core.resolveUrl(base, str.replace(/url\(|[|\)|\'|\"]/g, '')); var replaced = _store.getUrl(full).then(function(url){ - text = text.replace(str, 'url("'+url+'")'); - }); - + text = text.replace(str, 'url("'+url+'")'); + }, function(reason) { + deferred.reject(reason); + }); + promises.push(replaced); });