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
- Host: GitHub
- URL: https://github.com/rstudio/juicyjuice
- Owner: rstudio
- License: other
- Created: 2022-07-22T17:29:17.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T15:34:05.000Z (over 2 years ago)
- Last Synced: 2026-03-09T10:45:26.733Z (3 months ago)
- Topics: css, html, inlining, r
- Language: R
- Homepage: https://rstudio.github.io/juicyjuice/
- Size: 5.01 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
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.
