Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

28 lines
788B

  1. render_sass <- function(file, output = NULL, outdir = "dist") {
  2. if (is.null(output)) {
  3. output <- fs::path_file(file)
  4. fs::path_ext(output) <- "rstheme"
  5. }
  6. output <- fs::path(outdir, output)
  7. cliapp::cli_alert_success("{path {fs::path_rel(file, getwd())}}")
  8. sass::sass(sass::sass_file(paste(file)), output = output)
  9. }
  10. get_theme_name <- function(file) {
  11. x <- readLines(file, warn = FALSE)
  12. x <- grep("rs-theme-name", x, value = TRUE)
  13. if (!length(x)) return("")
  14. x <- sub("^\\s*/\\*\\s*rs-theme-name:\\s", "", x)
  15. x <- sub("\\s*\\*/\\s*$", "", x)
  16. x
  17. }
  18. cp_to_rstudio <- function(file) {
  19. cliapp::cli_alert("{arg \"{get_theme_name(file)}\"}")
  20. fs::file_copy(
  21. file,
  22. fs::path_home_r(".R", "rstudio", "themes", fs::path_file(file)),
  23. overwrite = TRUE
  24. )
  25. }