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
Suggestion: Explicitly discourage use of includeScript() and includeCSS()
#3225
Comments
incldueScript() and includeCSS()includeScript() and includeCSS()
|
To this point, it's probably worth mentioning |
|
I see in the docs that the If people are calling BTW, I didn't expect the average Shiny app author to use, or even know about, (And as usual, thanks for the feedback!) |
|
I think I've been seeing it popping up more and more recently, not only in packages, but it might be because they look at how proper shiny apps are built and see it used inside other packages. I've been seeing people use both BTW it's good to know that |
|
(Again, mostly useful for package developers, who can’t know what dependencies are going to be brought in by other packages used by the app author.) |
|
(This is probably a discussion better suited elsewhere, but I wanted to add my two cents) I do see the benefit of |
|
I don’t usually bother with htmlDependency for custom CSS and JS that’s specific for an app. But I also don’t usually use addResourcePath, rather just use the www dir (or alternatively, includeXXX). You should feel free to use whatever of these approaches you feel like, for custom CSS/JS the trade offs are not significant. |
|
Coincidentally, I just ran into a bug that has been present in my own code for years and went by undetected until it started causing errors recently. It was caused precisely for this reason, because I did not understand the includeScript/Css functions at the time :) daattali/addinslist#117 |
These functions come from {htmltools} but they are commonly used in shiny so I think posting in this repo is appropriate.
The problem I see with these functions is that they don't use the conventional system of including static resources, which can lead to confusion to anyone who isn't intimately familiar with the differences of
includeCSStolink(rel = "stylesheet"). Using include functions simply looks for the given file in the file system, completely ignoring any resource paths that may have been set. I've seen people be very confused about why these functions need to be given awww/prefix while images and any scripts or CSS loaded with the script and link tags don't need it. Similarly, it also means that it cannot load files under a resourcePath that's been added. And another small issue is that these functions result in inline css/js instead of linking to a file, but that's a minor issue.The text was updated successfully, but these errors were encountered: