Skip to content

Commit

Permalink
Enable static rendering for more examples
Browse files Browse the repository at this point in the history
Not enabled for examples that use themes because pkgdown puts <head> styles in the
body, causing FOUC.
  • Loading branch information
glin committed Sep 11, 2022
1 parent 369cace commit cae1a22
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 27 deletions.
2 changes: 2 additions & 0 deletions vignettes/100k-rows.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ output: html_document
knitr::opts_chunk$set(echo = TRUE)
set.seed(5)
options(reactable.static = TRUE)
```

```{r}
Expand Down
23 changes: 15 additions & 8 deletions vignettes/nba-box-score/nba-box-score.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ resource_files:

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
options(reactable.static = TRUE)
```

```{css ref.label='styles', echo=FALSE}
```

```{r ref.label='font_styles', echo=FALSE}
```

```{css ref.label='pkgdown_styles', echo=FALSE}
```

```{r box_score, echo=FALSE}
Expand Down Expand Up @@ -174,11 +185,11 @@ Raw data: [`line_score.csv`](line_score.csv), [`player_stats.csv`](player_stats.
```{r ref.label="box_score", eval=FALSE}
```

```{r}
tags$link(href = "https://fonts.googleapis.com/css?family=Roboto:400,500&display=fallback", rel = "stylesheet")
```{r font_styles, eval=FALSE}
htmltools::tags$link(href = "https://fonts.googleapis.com/css?family=Roboto:400,500&display=fallback", rel = "stylesheet")
```

```{css}
```{css styles, eval=FALSE}
.box-score {
font-family: 'Roboto', Helvetica, Arial, sans-serif;
}
Expand Down Expand Up @@ -282,16 +293,12 @@ tags$link(href = "https://fonts.googleapis.com/css?family=Roboto:400,500&display
}
```

```{css echo=FALSE}
```{css pkgdown_styles, include=FALSE}
/* rmarkdown html documents */
.main-container {
max-width: 1024px !important;
}
h1.title {
display: none;
}
/* pkgdown articles */
.row > main {
max-width: 1024px;
Expand Down
21 changes: 10 additions & 11 deletions vignettes/twitter-followers/twitter-followers.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ resource_files:

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
options(reactable.static = TRUE)
```

```{css ref.label="styles", echo=FALSE}
```

```{r ref.label="font_styles", echo=FALSE}
```

```{r table, echo=FALSE}
library(reactable)
Expand Down Expand Up @@ -94,12 +101,11 @@ How it was made: [Building the Twitter Followers Demo](../building-twitter-follo
```{r ref.label="table", eval=FALSE}
```

```{r}
tags$link(href = "https://fonts.googleapis.com/css?family=Karla:400,700|Fira+Mono&display=fallback",
rel = "stylesheet")
```{r font_styles, eval=FALSE}
htmltools::tags$link(href = "https://fonts.googleapis.com/css?family=Karla:400,700|Fira+Mono&display=fallback", rel = "stylesheet")
```

```{css}
```{css styles, eval=FALSE}
.twitter-followers {
margin: 0 auto;
width: 575px;
Expand Down Expand Up @@ -164,10 +170,3 @@ tags$link(href = "https://fonts.googleapis.com/css?family=Karla:400,700|Fira+Mon
height: 100%;
}
```

```{css echo=FALSE}
/* rmarkdown html documents */
h1.title {
display: none;
}
```
26 changes: 18 additions & 8 deletions vignettes/womens-world-cup/womens-world-cup.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ resource_files:

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
options(reactable.static = TRUE)
```

```{css ref.label="styles", echo=FALSE}
```

```{r ref.label="font_styles", echo=FALSE}
```

```{css ref.label="pkgdown_styles", echo=FALSE}
```

```{r table, echo=FALSE}
Expand Down Expand Up @@ -167,11 +178,14 @@ Full source: [`vignettes/womens-world-cup/womens-world-cup.Rmd`](https://github.
```{r ref.label="table", eval=FALSE}
```

```{r}
tags$link(href = "https://fonts.googleapis.com/css?family=Karla:400,700|Fira+Mono&display=fallback", rel = "stylesheet")
```{r font_styles, eval=FALSE}
htmltools::tags$link(
href = "https://fonts.googleapis.com/css?family=Karla:400,700|Fira+Mono&display=fallback",
rel = "stylesheet"
)
```

```{css}
```{css styles, eval=FALSE}
.standings {
font-family: Karla, "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 0.875rem;
Expand Down Expand Up @@ -267,16 +281,12 @@ tags$link(href = "https://fonts.googleapis.com/css?family=Karla:400,700|Fira+Mon
```


```{css echo=FALSE}
```{css pkgdown_styles, include=FALSE}
/* rmarkdown html documents */
.main-container {
max-width: 1054px !important;
}
h1.title {
display: none;
}
/* pkgdown articles */
.row > main {
max-width: 1054px;
Expand Down

0 comments on commit cae1a22

Please sign in to comment.