knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

Travis-CI Build Status AppVeyor Build Status codecov.io

juicer is a small wrapper around the juice javascript library for in-lining styles in HTML. It is intended as a building block for applications such as generating stylized HTML reports from R Markdown that can be sent via e-mail or uploaded to Google Docs with styles intact.

Installation

To install from github:

devtools::install_github('noamross/juicer')

Note that since this package uses V8, is has a system dependency of libv8. To quote from V8's README:

This package depends on libv8 around 3.14 or 3.16, which is the version included with most package managers:

Unfortunately the developers of libv8 do not care about backward compatibility and therefore recent branches of V8 (such as 3.22 or 4.xx) will not work. For this reason most distributions are unlikely to upgrade any time soon because it would break everything downstream (node, mongodb, etc).

The only distribution I am aware of that does not include a compatible version of v8 is OpenSUSE. So on this system you'll have to pull an older version from rpmfind or ruby gem or something.

Usage

The package has one function, juice(), which inlines the styles of HTML passed to it as a string, file, or URL:

library(juicer)
some_html = "<style>a {font-size:30;}</style><a href=\"http://ropensci.org\">ROpenSci</a>"
juice(some_html)

See ?juice and the javascript documentation for more options.

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.



noamross/juicer documentation built on May 23, 2019, 9:30 p.m.