Skip to content

Commit 4ca9dc6

Browse files
author
s0ph1e
committed
Check isEmbedded and isDuplicate only when needed
1 parent 46afe9d commit 4ca9dc6

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/css-parser.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@ function isEmbedded (src) {
88

99
function getUrls (text) {
1010
var urls = [];
11-
var urlMatch, url, isEmbeddedUrl, isDuplicatedUrl;
11+
var urlMatch, url;
1212

1313
text = text.replace(commentRegexp, '');
1414

1515
while (urlMatch = urlsRegexp.exec(text)) {
1616
// Match 2 group if '[@import] url(path)', match 5 group if '@import path'
1717
url = urlMatch[2] || urlMatch[5];
1818

19-
isEmbeddedUrl = isEmbedded(url);
20-
isDuplicatedUrl = urls.indexOf(url) !== -1;
21-
22-
if (url && !isEmbeddedUrl && !isDuplicatedUrl) {
19+
if (url && !isEmbedded(url) && urls.indexOf(url) === -1) {
2320
urls.push(url);
2421
}
2522
}

0 commit comments

Comments
 (0)