Skip to content
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

Add support for local base url #171

Closed
lesleyxyz opened this issue Nov 10, 2022 · 7 comments · Fixed by #172
Closed

Add support for local base url #171

lesleyxyz opened this issue Nov 10, 2022 · 7 comments · Fixed by #172
Assignees

Comments

@lesleyxyz
Copy link

lesleyxyz commented Nov 10, 2022

Currently, when you supply a local directory for base_url it gives the following error:

Traceback (most recent call last):
  File "/redacted.py", line 181, in build_html_templates
    inlined = css_inline.inline(f.read(), base_url="/my/css/folder/")
ValueError: relative URL without a base

With base_url file://my/css/folder/ it doesn't throw an error, but doesn't do any inlining

Am I doing something wrong or is this not supported at the moment?

@Stranger6667 Stranger6667 self-assigned this Nov 10, 2022
@Stranger6667
Copy link
Owner

Stranger6667 commented Nov 10, 2022

Hi @lesleyxyz

Thank you for opening this issue! Indeed, this one is missing - base_url only works for network stuff. I think we need to support the "file" scheme, so something like this would work (note three slashes for an absolute path):

file:///my/css/folder/

@Stranger6667
Copy link
Owner

#172 adds support for this

@lesleyxyz
Copy link
Author

Damn that was quick, thank you so much!

@Stranger6667
Copy link
Owner

You're very welcome :)

@Stranger6667
Copy link
Owner

The change is released in 0.8.6

@Stranger6667
Copy link
Owner

Let me know if it would not work for your use case

@lesleyxyz
Copy link
Author

Just tested it today and working perfectly, so thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants