# juice **Repository Path**: mirrors_FGRibreau/juice ## Basic Information - **Project Name**: juice - **Description**: Juice inlines CSS stylesheets into your HTML source. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-24 - **Last Updated**: 2026-07-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [](https://travis-ci.org/LearnBoost/juice) [](https://david-dm.org/LearnBoost/juice) # Juice  Given HTML, juice will inline your CSS properties into the `style` attribute. ## How to use ```js var juice = require('juice'); juice("/path/to/file.html", function(err, html) { console.log(html); }); ``` `/path/to/file.html`: ```html
Test
``` `style.css` ```css p { text-decoration: underline; } ``` Output: ```htmlTest
``` ## What is this useful for ? - HTML emails. For a comprehensive list of supported selectors see [here](http://www.campaignmonitor.com/css/) - Embedding HTML in 3rd-party websites. ## Projects using juice * [node-email-templates][1] - Node.js module for rendering beautiful emails with [ejs][2] templates and email-friendly inline CSS using [juice][3]. * [swig-email-templates][4] - Uses [swig][5], which gives you [template inheritance][6], and can generate a [dummy context][7] from a template. [1]: https://github.com/niftylettuce/node-email-templates [2]: https://github.com/visionmedia/ejs [3]: https://github.com/LearnBoost/juice [4]: https://github.com/superjoe30/swig-email-templates [5]: https://github.com/paularmstrong/swig [6]: https://docs.djangoproject.com/en/dev/topics/templates/#template-inheritance [7]: https://github.com/superjoe30/swig-dummy-context ## Documentation ### juice(filePath, [options], callback) * `filePath` - html file * `options` - (optional) object containing these properties: - `extraCss` - extra css to apply to the file. Defaults to `""`. - `applyStyleTags` - whether to inline styles in `` Defaults to `true`. - `applyLinkTags` - whether to resolve `` tags and inline the resulting styles. Defaults to `true`. - `removeStyleTags` - whether to remove the original `` tags after (possibly) inlining the css from them. Defaults to `true`. - `removeLinkTags` - whether to remove the original `` tags after (possibly) inlining the css from them. Defaults to `true`. - `url` - how to resolve hrefs. Defaults to using `filePath`. If you want to override, be sure your `url` has the protocol at the beginning, e.g. `http://` or `file://`. * `callback(err, html)` - `err` - `Error` object or `null`. - `html` - contains the html from `filePath`, with potentially `