-
-
Notifications
You must be signed in to change notification settings - Fork 192
Extract URLs from CSS #1956
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
Extract URLs from CSS #1956
Conversation
In #1485 it was requested to extract URLs from CSS files and inline styles. While lychee proper is generally becoming more conservative about the file types we support, the places where links can occur in CSS are pleasantly limited to `url()` directives (with the exception of inline URLs in `font-face` and `@import` rules, which we conveniently ignore for now). As such, integrating CSS support into lychee can be done by means of a simple extractor utilizing a bunch of regular expressions. It's not quite as exhaustive as a proper CSS parser (such as Servo's rust-cssparser crate), but on the plus side, we don't need to add additional dependencies. Fixes #1485
9b3f374 to
e80be51
Compare
|
I briefly considered adding SCSS/SASS file support as well, but decided against it. Mainly for the following reasons:
Besides, users can opt-in with |
Use top-level assert_eq for less code and better coverage
thomas-zahner
left a comment
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.
I've added 5409ff9. Do you agree with that? It's less code and yields better coverage
Absolutely! I forgot we had that. Much better, thanks. |
|
AFAICT, the only open question is what we do with #1956 (comment). |
|
I see no problems, so we're good to merge |
|
Thanks for the swift review. |
In #1485 it was requested to extract URLs from CSS files and inline styles.
While lychee proper is generally becoming more conservative about the file types we support, the places where links can occur in CSS are pleasantly limited to
url()directives (with the exception of inline URLs infont-faceand@importrules, which we conveniently ignore for now).As such, integrating CSS support into lychee can be done by means of a simple extractor utilizing a bunch of regular expressions. It's not quite as exhaustive as a proper CSS parser (such as Servo's rust-cssparser crate), but on the plus side, we don't need to add additional dependencies.
Fixes #1485