#! /usr/bin/env Rscript library(sass) library(fs) library(purrr) render_sass <- function(file, output = NULL, outdir = "rsthemes") { if (is.null(output)) { output <- file path_ext(output) <- "rstheme" } output <- path(outdir, output) sass(sass_file(paste(file)), output = output) } dir_create("rsthemes") dir_ls(regexp = "^[^_].+\\.scss") %>% walk(render_sass) cp_to_rstudio <- function(file) { file_copy( file, path_home_r(".R", "rstudio", "themes", path_file(file)), overwrite = TRUE ) } dir_ls("rsthemes", regexp = "\\.rstheme") %>% walk(cp_to_rstudio)