Skip to content

Instantly share code, notes, and snippets.

@cpsievert
Last active January 10, 2020 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpsievert/e7086e9b57d7e03b4ecc5213d70d3b26 to your computer and use it in GitHub Desktop.
Save cpsievert/e7086e9b57d7e03b4ecc5213d70d3b26 to your computer and use it in GitHub Desktop.
---
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