Last active
January 10, 2020 20:38
-
-
Save cpsievert/e7086e9b57d7e03b4ecc5213d70d3b26 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Untitled" | |
output: | |
html_document: | |
highlight: tango | |
--- | |
```{r} | |
library(sass) | |
bg_black <- list( | |
list("body-bg" = "black"), | |
"body{background-color: $body-bg;}" | |
) | |
color_white <- list( | |
list("color" = "white"), | |
"body{color: $color;}" | |
) | |
``` | |
Printing by default embeds the CSS as HTML. | |
```{r} | |
sass(bg_black) | |
``` | |
Printing with `class.output='css'` and `comment=''` allows for syntax highlighting. | |
```{r, class.output='css', comment=''} | |
sass(bg_black) | |
``` | |
Also works with `sass` objects: | |
```{r} | |
as_sass(color_white) | |
``` | |
```{r, class.output='css', comment=''} | |
as_sass(color_white) | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment