Skip to content

Commit 88b8ddc

Browse files
authoredSep 8, 2020
fix: line breaks in url function
1 parent 8b865fe commit 88b8ddc

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed
 

‎src/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ function defaultGetLocalIdent(
7878
function normalizeUrl(url, isStringValue) {
7979
let normalizedUrl = url;
8080

81-
if (isStringValue && /\\[\n]/.test(normalizedUrl)) {
82-
normalizedUrl = normalizedUrl.replace(/\\[\n]/g, '');
81+
if (isStringValue && /\\(\n|\r\n|\r|\f)/.test(normalizedUrl)) {
82+
normalizedUrl = normalizedUrl.replace(/\\(\n|\r\n|\r|\f)/g, '');
8383
}
8484

8585
if (matchNativeWin32Path.test(url)) {

‎test/__snapshots__/url-option.test.js.snap

+24-4
Large diffs are not rendered by default.

‎test/fixtures/url/url.css

+5
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,13 @@ a {
301301
background: url("./img img.png");
302302
}
303303

304+
/* Comment */
305+
304306
.class.class.class {
305307
background: url('./img\
308+
(img.png');
309+
background: url('./img\(img.png');
310+
background: url('./img\
306311
(img.png');
307312
background: url('./img\
308313
\

0 commit comments

Comments
 (0)
Please sign in to comment.