epublib.css module¶
- class CSS(content: str)¶
Bases:
objectA simple CSS parser to extract and replace URLs in CSS content.
- get_urls() Generator[str]¶
Extract all URLs from the CSS content.
- Yields:
The extracted URLs.
- replace_urls(
- replacer: Callable[[str], str | None],
Replace all URLs in the CSS content using the provided replacer function.
- Parameters:
replacer – A function that takes the original URL and returns the new URL.
- replace_url(old: str, repl: str) None¶
Replace given URL in the CSS with the replacement.
- Parameters:
old – The URL to be replaced.
repl – The replacement URL.