Closed DavidPatShuiFong closed 5 years ago
Hi David,
you don't need to set this path for images "./www/assets/..." Simply let "assets/my_image.svg".
Moreover, try to rename your main file "app.R" and launch it with the run App button in the central panel.
This is issue is unfortunately not related to the shinydashboardePlus package.
In a package I usually create some custom path for my images such as:
.onAttach <- function(libname, pkgname) {
addResourcePath('logos', system.file("logos", package = "CaPO4Sim"))
addResourcePath('CaPO4_network', system.file("CaPO4_network", package = "CaPO4Sim"))
}
I put this in a zzz.R file for instance.
All my images are contained in the inst folder but I don't need to use "inst/CaPO4_network" when providing links.
Have a look at https://github.com/DivadNojnarg/CaPO4Sim
Thanks Divad, that worked! I gradually discovered through more searching that 'addResourcePath' and 'system.file' might be part of the solution, but strangely none of the other answers on StackOverflow etc. did what you did. More importantly, none of the other solutions actually worked in a 'package' situation. (I'll try to add your effective answer to some of those questions on StackOverflow)
Thanks even more for the example. I found what I was looking for in the R/zzz.R
and R/network_utils.R
.
My apologies, I see now that this is a general 'how to write R packages' issue, rather than a shinydashboardplus problem. So, extra thanks for the help!
I was able to use a local .svg file as the icon file (as defined by
src=
).I used a reference like
src = "./assets/icons/user-avatar.svg"
, whereassets
is a directory underwww
.I am now
packaging
my application, so I moved thewww
directory to theinst
directory and changed thesrc
reference tosrc = "./www/assets/icons/user-avatar.svg"
. That doesn't work.Even worse, I can't figure out a way to know how to figure out what is wrong with the file reference!
Thanks for any help