diff --git a/DESCRIPTION b/DESCRIPTION index 89ee793f..6b99378f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: golem Title: A Framework for Robust Shiny Applications -Version: 0.2.0 +Version: 0.2.1 Authors@R: c(person(given = "Vincent", family = "Guyader", diff --git a/NEWS.md b/NEWS.md index b7b868d1..669fc352 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,11 @@ > Notes: the # between parenthesis referes to the related issue on GitHub, and the @ refers to an external contributor solving this issue. +# golem 0.2.9000+ + +## bug fix + ++ fixed issue with favicon when package is built (#387) + # golem 0.1.9000+ ## New functions diff --git a/R/use_favicon.R b/R/use_favicon.R index 68d56a5e..03714fc4 100644 --- a/R/use_favicon.R +++ b/R/use_favicon.R @@ -95,16 +95,16 @@ use_favicon <- function( ) } - cat_line( - "Favicon is automatically linked in app_ui via `golem_add_external_resources()`" - ) - cat_red_bullet( - sprintf( - "No file found at %s", - path + if (ext == "png"){ + cat_red_bullet( + "You choose a png favicon, please add `ext = 'png'` to the `favicon()` function in golem_add_external_resources()." ) - ) - + } else { + cat_line( + "Favicon is automatically linked in app_ui via `golem_add_external_resources()`" + ) + } + } #' @rdname favicon @@ -138,34 +138,23 @@ remove_favicon <- function( #' @param ico path to favicon file #' @param rel rel #' @param resources_path prefix of the resource path of the app -#' @inheritParams add_modules +#' @param ext the extension of the favicon #' #' @export #' @importFrom htmltools tags favicon <- function( - ico, + ico = "favicon", rel="shortcut icon", resources_path = "www", - pkg = get_golem_wd() + ext = "ico" ){ - if (missing(ico)){ - ici <- list.files( - pattern = "favicon", - fs::path( - pkg, - "inst/app/www" - ) - ) - attempt::stop_if( - length(ici), - ~ .x > 2, - "You have 2 favicons inside your app/www folder, please remove one." - ) - ico <- fs::path( - resources_path, - ici - ) - } + + ico <- fs::path( + resources_path, + ico, + ext = ext + ) + tags$head( tags$link( rel = rel, diff --git a/man/favicon.Rd b/man/favicon.Rd index 70b8167c..5c44588b 100644 --- a/man/favicon.Rd +++ b/man/favicon.Rd @@ -10,8 +10,8 @@ use_favicon(path, pkg = get_golem_wd(), method = "curl") remove_favicon(path = "inst/app/www/favicon.ico") -favicon(ico, rel = "shortcut icon", resources_path = "www", - pkg = get_golem_wd()) +favicon(ico = "favicon", rel = "shortcut icon", + resources_path = "www", ext = "ico") } \arguments{ \item{path}{Path to your favicon file (.ico or .png)} @@ -25,6 +25,8 @@ favicon(ico, rel = "shortcut icon", resources_path = "www", \item{rel}{rel} \item{resources_path}{prefix of the resource path of the app} + +\item{ext}{the extension of the favicon} } \description{ This function adds the favicon from \code{ico} to your shiny app.