| @@ -20,8 +20,17 @@ cli_alert_info("Compiling themes...") | |||
| dir_ls("src", regexp = "^[^_].+\\.scss") %>% | |||
| walk(render_sass) | |||
| get_theme_name <- function(file) { | |||
| x <- readLines(file, warn = FALSE) | |||
| x <- grep("rs-theme-name", x, value = TRUE) | |||
| if (!length(x)) return("") | |||
| x <- sub("^\\s*/\\*\\s*rs-theme-name:\\s", "", x) | |||
| x <- sub("\\s*\\*/\\s*$", "", x) | |||
| x | |||
| } | |||
| cp_to_rstudio <- function(file) { | |||
| cli_alert("{path {path_file(file)}}") | |||
| cli_alert("{emph {get_theme_name(file)}}") | |||
| file_copy( | |||
| file, | |||
| path_home_r(".R", "rstudio", "themes", path_file(file)), | |||