Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/noamross/juicer
A thin wrapper for in-lining CSS styles into HTML
https://github.com/noamross/juicer
Last synced: about 2 months ago
JSON representation
A thin wrapper for in-lining CSS styles into HTML
- Host: GitHub
- URL: https://github.com/noamross/juicer
- Owner: noamross
- License: other
- Created: 2016-03-05T02:08:09.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-10-05T16:52:24.000Z (about 6 years ago)
- Last Synced: 2024-08-09T02:16:56.361Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 205 KB
- Stars: 22
- Watchers: 5
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - noamross/juicer - A thin wrapper for in-lining CSS styles into HTML (JavaScript)
README
---
output:
md_document:
variant: markdown_github
---```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```[![Travis-CI Build Status](https://travis-ci.org/noamross/juicer.svg?branch=master)](https://travis-ci.org/noamross/juicer)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/noamross/juicer?branch=master&svg=true)](https://ci.appveyor.com/project/noamross/juicer)
[![codecov.io](https://codecov.io/github/noamross/juicer/coverage.svg?branch=master)](https://codecov.io/github/noamross/juicer?branch=master)**juicer** is a small wrapper around the **[juice](https://github.com/Automattic/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:
>
> - Debian: [libv8-3.14-dev](https://packages.debian.org/sid/libv8-3.14-dev)
> - Fedora/EPEL: [v8-devel](https://apps.fedoraproject.org/packages/v8-devel)
> - Arch: [v8-3.14](https://aur.archlinux.org/packages/v8-3.14/)
> - OSX: [v8-315](https://github.com/Homebrew/homebrew-versions/blob/master/v8-315.rb) (`brew tap homebrew/versions; brew install v8-315`)
>
> 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](http://www.rpmfind.net/linux/rpm2html/search.php?query=v8&system=opensuse) or [ruby gem](https://rubygems.org/gems/libv8/versions/3.16.14.7) or something.
# UsageThe package has one function, `juice()`, which inlines the styles of HTML
passed to it as a string, file, or URL:```{r}
library(juicer)
some_html = "a {font-size:30;}ROpenSci"
juice(some_html)
```See `?juice` and the [javascript documentation](https://github.com/Automattic/juice) for more options.
# Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.