From e5134ef03aaad5375545dd22b8f492cdbf95c2e1 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Mon, 17 Apr 2017 17:32:18 +0300 Subject: [PATCH] Fixed: url has a trailing space is now handled [#237]. --- lib/processCss.js | 2 ++ test/urlTest.js | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/lib/processCss.js b/lib/processCss.js index 181f7a2ab..ec01f0e93 100644 --- a/lib/processCss.js +++ b/lib/processCss.js @@ -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; } diff --git a/test/urlTest.js b/test/urlTest.js index b54bf9a8b..74283f0ca 100644 --- a/test/urlTest.js +++ b/test/urlTest.js @@ -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 }", ""] ]); @@ -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");