Skip to main content

extract_css

Function extract_css 

Source
pub(crate) fn extract_css<S: SpanProvider>(
    input: &str,
    span_provider: &S,
) -> Vec<RawUri>
Expand description

Extract all URLs from CSS content

This function finds all url() occurrences in CSS and extracts the URLs.

§Arguments

  • input - The CSS content to extract URLs from
  • span_provider - Provides source location information for extracted URLs

§Returns

A vector of RawUri objects representing the extracted URLs

§Examples

CSS input:

.example {
    background-image: url("./image.png");
    background: url('/absolute/path.jpg');
}
@import url(https://example.com/style.css);

Extracts 3 URLs: ./image.png, /absolute/path.jpg, and https://example.com/style.css