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

HTMLDependency does not work with external script sources #45

Open
schloerke opened this issue Oct 21, 2022 · 3 comments
Open

HTMLDependency does not work with external script sources #45

schloerke opened this issue Oct 21, 2022 · 3 comments

Comments

@schloerke
Copy link
Collaborator

https://github.com/rstudio/py-htmltools/blob/ae298449b10de5a193031d7c72d7216f7611cf5a/htmltools/_core.py#L1094-L1098

I'd expect to be able to write:

HTMLDependency(
	"mediapipe-hand",
    "0.0.1",
	source={"href":"https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils"},
    script=[{"src":"camera_utils.js"}]
).as_html_tags()
#> <script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js"></script>

Currently, it produces:

<script src="/camera_utils.js"></script>

Can I have a HTMLDependency that points to external scripts?

@cpsievert
Copy link
Collaborator

cpsievert commented Oct 21, 2022

Yea, that seems like an oversight

@wch
Copy link
Collaborator

wch commented Oct 21, 2022

IIRC, we had considered this but hadn’t defined the type for when the source is a remote url. There may be some prior discussion about this.

@wch
Copy link
Collaborator

wch commented Oct 24, 2022

Just to follow up: I think the idea was to create a new type similar to HTMLDependencySource, but with fields that are appropriate for remote sources

https://github.com/rstudio/py-htmltools/blob/ae298449b10de5a193031d7c72d7216f7611cf5a/htmltools/_core.py#L889-L891

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

No branches or pull requests

3 participants