-
-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed issue with "url(""); ... any other css code .. url("file.jpg"); in one line #337
base: master
Are you sure you want to change the base?
Conversation
….svg");" CSS code
….svg");" CSS code
85ee174
to
227f190
Compare
please check for both ["] & ['] ; |
Done |
@@ -252,7 +252,7 @@ protected function combineImports($source, $content, $parents) | |||
*/ | |||
protected function importFiles($source, $content) | |||
{ | |||
$regex = '/url\((["\']?)(.+?)\\1\)/i'; | |||
$regex = '/url\((["\']?)([^"\']+?)\\1\)/i'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be a problem when a quote is encountered inside the url.
I think changing the regex to '/url\((["\']?)(.*?)\\1\)/i';
instead of '/url\((["\']?)(.+?)\\1\)/i';
(note the *
instead of +
, which would allow an empty url value) should also work.
Could you confirm whether that fixes your issue, and resubmit if so?
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an empty URL should not get parsed
949e01d
to
51d1aa4
Compare
For CSS files with
url("")
and any other url() within one line, the second file was ignored.See https://regex101.com/r/IkhmxT/2
Sure, "url()" is invalid CSS syntax, but this should be ignored and other URLs in the same line should get handled correctly.