-
Notifications
You must be signed in to change notification settings - Fork 221
Expand file tree
/
Copy pathcompile_scss.R
More file actions
33 lines (29 loc) · 968 Bytes
/
compile_scss.R
File metadata and controls
33 lines (29 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#' @noRd
compile_scss <- function(data, id = NULL) {
# Obtain the SCSS options table from `data`
gt_options_tbl <-
dt_options_get(data = data) %>%
subset(scss) %>%
subset(!is.na(value))
has_id <- !is.null(id)
sass::sass(
list(
list(element_id = id),
as.list(stats::setNames(gt_options_tbl$value, gt_options_tbl$parameter)),
sass::sass_file(system_file(file = "css/gt_colors.scss")),
sass::sass_file(system_file(file = "css/gt_styles_default.scss")),
glue::glue(
.open = "<<", .close = ">>",
"
<<ifelse(has_id, 'html, :host', '.gt_table')>> {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans',
Arial, sans-serif;
}
<<ifelse(has_id, '##{$element_id} {', '')>>
@include gt_styles();
<<ifelse(has_id, '}', '')>>
")
)
)
}