Skip to content

pngquant for smaller vignettes #116

@bastistician

Description

@bastistician

Re minimalism: knitr supports a hook_pngquant for smaller vignette outputs, but litedown seems to lack such a built-in compression feature. I sense conflicting interests as litedown aims to be minimal by itself. OTOH, "overall" minimalism could be strengthened by shrinking vignettes engine-wise.

FWIW, as a workaround, I added the following chunk at the end of the Rmd source file, meant to be evaluated only when building the package:

```{r, compact-PNGs, include=FALSE, purl=FALSE, eval=USE_PNGQUANT}
system2("pngquant",
        c("--skip-if-larger", "--speed=1", "--ext=.png", "--force",
          "--", shQuote(litedown::get_context("plot_files"))))
```

Works for me (and shrinks my vignette from 80K to 54K), but this kludge might not be suitable in all cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions