Skip to content

Commit

Permalink
Fixed: url has a trailing space is now handled [webpack-contrib#237].
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Apr 20, 2017
1 parent 2ee7552 commit e5134ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/processCss.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ module.exports = function processCss(inputSource, inputMap, options, callback) {
mode: options.mode,
rewriteUrl: function(global, url) {
if(parserOptions.url){
url = url.trim(" ");

if(!loaderUtils.isUrlRequest(url, root)) {
return url;
}
Expand Down
6 changes: 6 additions & 0 deletions test/urlTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ describe("url", function() {
test("background img 3", ".class { background: green url( 'img.png' ) xyz }", [
[1, ".class { background: green url({./img.png}) xyz }", ""]
]);
test("background img 4", ".class { background: green url( img.png ) xyz }", [
[1, ".class { background: green url({./img.png}) xyz }", ""]
]);
test("background img absolute", ".class { background: green url(/img.png) xyz }", [
[1, ".class { background: green url(/img.png) xyz }", ""]
]);
Expand Down Expand Up @@ -63,6 +66,9 @@ describe("url", function() {
test("background img 3 with url", ".class { background: green url( 'img.png' ) xyz }", [
[1, ".class { background: green url( 'img.png' ) xyz }", ""]
], "?-url");
test("background img 4 with url", ".class { background: green url( img.png ) xyz }", [
[1, ".class { background: green url( img.png ) xyz }", ""]
], "?-url");
test("background img absolute with url", ".class { background: green url(/img.png) xyz }", [
[1, ".class { background: green url(/img.png) xyz }", ""]
], "?-url");
Expand Down

0 comments on commit e5134ef

Please sign in to comment.