An open API service indexing awesome lists of open source software.

https://github.com/rstudio/juicyjuice

CSS style inlining with Juice
https://github.com/rstudio/juicyjuice

css html inlining r

Last synced: about 2 months ago
JSON representation

CSS style inlining with Juice

Awesome Lists containing this project

README

          





CRAN status
R build status
Linting

Monthly Downloads
Total Downloads

Contributor Covenant





With the **juicyjuice** package it’s fairly easy to transform HTML such that all CSS is inlined directly into HTML tags.

So this:

`div{color:blue;}

`

Will turn to this:

`

`

Why do this? An important use case is HTML email and this is mainly because of Outlook on Windows (it does not support multiple classes on elements). Furthermore CSS inlining can help preserve a decent layout in email clients that do not support embedded CSS (in `` tags), or, when an email is forwarded. Here's another reason to use this: embedding HTML in 3rd-party websites.

This **R** package contains a single function, `css_inline()`, where the only input required is a string of HTML text. It uses the **juice** JavaScript library (https://github.com/Automattic/juice), which is (1) well-tested, (2) very performant, and (3) has lots of great features. The aformentioned function will return a string of CSS-inlined HTML.

## INSTALLATION

The **juicyjuice** package can be installed from **CRAN** with:

``` r
install.packages("juicyjuice")
```

You can also choose to install the development version of **juicyjuice** from
**GitHub**:

``` r
devtools::install_github("rstudio/juicyjuice")
```

If you encounter a bug, have usage questions, or want to share ideas to
make this package better, please feel free to file an
[issue](https://github.com/rstudio/juicyjuice/issues).

## Code of Conduct

Please note that the juicyjuice project is released with a [contributor code of conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).<br>By participating in this project you agree to abide by its terms.

## πŸ“„ License

**juicyjuice** is licensed under the MIT license. See the [`LICENSE.md`](LICENSE.md) file for more details.

Β© Posit Software, PBC.

## πŸ›οΈ Governance

This project is primarily maintained by [Rich Iannone](https://twitter.com/riannone). Should there also be other authors, they might occasionally assist with some of these duties.