-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Feature Request: Update font-awesome version #1966
Comments
Which link are you following to the list of Font Awesome icons? If one heads over to the Font Awesome 4.7 website, see https://fontawesome.com/v4.7.0/, the icons listed ought to all work with |
Some notes regarding FA 4 vs 5: https://www.drupal.org/project/fontawesome/issues/2930071 |
Just adding a +1 for this request. |
I just committed some changes into a fork at JesseVent@9ce6f87 which appear to work, build passes all tests and CRAN checks. So could be something to look into - Unfortunately I couldn't think of a way to provide fallback support for 4.7.0 other than using a mapping document in a csv file. Seems to work pretty well in the scenarios I tested, definitely renders in-app. Hope it helps. icon <- function(name, class = NULL, lib = "font-awesome", style="fas") {
prefixes <- list(
"font-awesome" = "fa",
"glyphicon" = "glyphicon"
)
prefix <- prefixes[[lib]]
# determine stylesheet
if (is.null(prefix)) {
stop("Unknown font library '", lib, "' specified. Must be one of ",
paste0('"', names(prefixes), '"', collapse = ", "))
}
# Add fallback support for 4.7.0 by checking for legacy icons names and replacing with 5.2.0 names
if ( prefix == "fa" && !is.null(name)) {
mapfile <- system.file("www","shared","font-awesome", "fa-mapping.csv", package = "shiny")
fa_lookup <- read.csv(mapfile, stringsAsFactors = FALSE)
match <- match(name, fa_lookup$v4_name)
prefix_tag <- NA
if (!is.na(match)) {
match <- as.numeric(match)
name <- fa_lookup$v5_name[match]
prefix_tag <- fa_lookup$prefix[match]
}
if (is.na(prefix_tag)) prefix_tag <- style
}
# build the icon class (allow name to be null so that other functions
# e.g. buildTabset can pass an explicit class value)
iconClass <- ""
if (!is.null(name)) {
# support for glyphicon
if(prefix != "fa") iconClass <- paste0(prefix, " ", prefix, "-", name)
# new font-awesome format
if(prefix == "fa") iconClass <- paste0(prefix_tag, " ", prefix, "-", name)
}
if (!is.null(class)) iconClass <- paste(iconClass, class)
iconTag <- tags$i(class = iconClass)
# font-awesome needs an additional dependency (glyphicon is in bootstrap)
if (lib == "font-awesome") {
htmltools::htmlDependency("font-awesome", "5.2.0", c(href="shared/font-awesome"), script = "js/all.js")
}
iconTag
} * checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking examples ... OK
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
* Running ‘test-all.R’ OK
* DONE
Status: 1 NOTE
checking installed package size ... NOTE
R CMD check results
0 errors | 0 warnings | 1 note
R CMD check succeeded |
- Upgrades FontAwesome to a new major (breaking) version, but is backwards compatible because we include the v4-shims CSS that maps old names to new. - This is a step toward full V5 adoption that doesn't require us to come up with a plan for deprecating V4 icon names. - Details: https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4 - Related to #2156 and #1966
* Upgrade FontAwesome to 5.3.1 - Upgrades FontAwesome to a new major (breaking) version, but is backwards compatible because we include the v4-shims CSS that maps old names to new. - This is a step toward full V5 adoption that doesn't require us to come up with a plan for deprecating V4 icon names. - Details: https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4 - Related to #2156 and #1966 * Improvements to icon - Clarify in docs that fontawesome V5 icons accessible with V4-style names - Make icons browseable: icon('address-book') will now open the Viewer pane of RStudio IDE so that icons can be experimented with more easily. * Update LICENSE with CC for FontAwesome .svgs * Update NEWS
We've decided to upgrade to 5.3.1 and include the fontawesome v4 compatibility shim. This should ensure that everybody can use the new icons without existing apps breaking (though some of the fancy new functionality in fontawesome 5 will not be available--hopefully you will be able to use that through the rstudio/fontawesome or ropenscilabs/icon package). |
shiny/R/bootstrap.R
Line 1547 in 174a1fe
I've noticed theres been huge changes the font-awesome icons in the last few versions they have released, the documentation for
icons()
is now is incorrect as most of the icons listed through their explorer will fail to load when using in shiny app.Please update the font-awesome font files or the new svg implementation
The text was updated successfully, but these errors were encountered: