juice: In-line CSS styles

Description Usage Arguments Value Examples

Description

This function an HTML file with <style> tags an in-lines the styles. It does not currently in-line styles from external files or resources automatically, though styles may be applied with the css= argument or options=list(extraCss=)

Usage

1
juice(html, options = NULL, css = NULL)

Arguments

html

HTML as a string, or a file or URL

options

A list of options to pass to juice. See https://github.com/Automattic/juice#options for

css

(Optional) CSS to apply to the file, as a string, file or URL. If provided, ONLY this CSS will be inlined. If you wish to pass additional CSS in addition to that in <style> tags in your HTML, provide it as a string named extraCss= in the options parameter.

Value

A string of HTML with styles in-lined

Examples

1
2
3
4
some_html = "<style>a {font-size:30;}</style><a href='http://www.ropensci.org'>ROpenSci</a>"
juice(some_html)
# Don't apply style tags, but remove them
juice(some_html, options=list(applyStyleTags=FALSE, removeStyleTags=TRUE))

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