Is there a design reason why includeCSS() does not look inside www/ folder?

359 views
Skip to first unread message

Dean Attali

unread,
Dec 29, 2015, 9:17:25 PM12/29/15
to Shiny - Web Framework for R
I have code in many of my apps to load CSS files. I usually put them inside a `www/` directory and use

tags$head(tags$link(href = "style.css", rel = "stylesheet"))

I wanted to switch to using the `includeCSS()` function instead, but I noticed that it assumes the CSS file lives in the main app directory rather than inside `www/`.  Other resources such as images are also by default assumed to be under `www/` (I'm guessing this was done using `addResourcePath()?`), so I was just wondering if there was a reason this function doesn't make that same assumption?

Joe Cheng

unread,
Dec 30, 2015, 8:55:36 PM12/30/15
to Dean Attali, Shiny - Web Framework for R
Why switch to includeCSS? The way you're doing it is how I would do it.

includeCSS takes an arbitrary file path, so there's no assumption at all about where it lives. It's simply resolving relative paths according to the current working directory. With images, you're probably talking about relative *URL* paths, and yes, those are mapped to www/ as the root directory. That's different because the path in question is sent to the client, and the client makes the request back to the server--hence the need to use www/ to make sure we don't serve up data that's not supposed to be public.

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/9f2b3c2e-7d10-46a3-a67b-21dc052654ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages