Skip to content

Commit 2ca3963

Browse files
author
evilebottnawi
committed
Fixed: url has a trailing space is now handled [#237].
1 parent 2ee7552 commit 2ca3963

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/processCss.js

+2
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ module.exports = function processCss(inputSource, inputMap, options, callback) {
153153
mode: options.mode,
154154
rewriteUrl: function(global, url) {
155155
if(parserOptions.url){
156+
url = url.trim(" ");
157+
156158
if(!loaderUtils.isUrlRequest(url, root)) {
157159
return url;
158160
}

test/urlTest.js

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ describe("url", function() {
1212
test("background img 3", ".class { background: green url( 'img.png' ) xyz }", [
1313
[1, ".class { background: green url({./img.png}) xyz }", ""]
1414
]);
15+
test("background img 4", ".class { background: green url( img.png ) xyz }", [
16+
[1, ".class { background: green url({./img.png}) xyz }", ""]
17+
]);
1518
test("background img absolute", ".class { background: green url(/img.png) xyz }", [
1619
[1, ".class { background: green url(/img.png) xyz }", ""]
1720
]);
@@ -63,6 +66,9 @@ describe("url", function() {
6366
test("background img 3 with url", ".class { background: green url( 'img.png' ) xyz }", [
6467
[1, ".class { background: green url( 'img.png' ) xyz }", ""]
6568
], "?-url");
69+
test("background img 4 with url", ".class { background: green url( img.png ) xyz }", [
70+
[1, ".class { background: green url( img.png ) xyz }", ""]
71+
], "?-url");
6672
test("background img absolute with url", ".class { background: green url(/img.png) xyz }", [
6773
[1, ".class { background: green url(/img.png) xyz }", ""]
6874
], "?-url");

0 commit comments

Comments
 (0)