You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 line
826B

  1. #! /usr/bin/env Rscript
  2. library(sass)
  3. library(fs)
  4. library(purrr)
  5. library(cliapp)
  6. render_sass <- function(file, output = NULL, outdir = "rsthemes") {
  7. if (is.null(output)) {
  8. output <- file
  9. path_ext(output) <- "rstheme"
  10. }
  11. output <- path(outdir, output)
  12. cli_alert_success("{path {path_file(file)}}")
  13. sass(sass_file(paste(file)), output = output)
  14. }
  15. dir_create("rsthemes")
  16. cli_alert_info("Compiling themes...")
  17. dir_ls(regexp = "^[^_].+\\.scss") %>%
  18. walk(render_sass)
  19. cp_to_rstudio <- function(file) {
  20. cli_alert("{path {path_file(file)}}")
  21. file_copy(
  22. file,
  23. path_home_r(".R", "rstudio", "themes", path_file(file)),
  24. overwrite = TRUE
  25. )
  26. }
  27. cli_alert_info('Installing themes to {path {path_home_r(".R", "rstudio", "themes")}}')
  28. dir_ls("rsthemes", regexp = "\\.rstheme") %>%
  29. walk(cp_to_rstudio)