{"_id":"juice2","_rev":"34-61d1cac997372c409ddebbaf73313483","name":"juice2","description":"Inlines css into html source","dist-tags":{"latest":"1.3.1"},"versions":{"0.5.0":{"name":"juice2","version":"0.5.0","description":"Inlines css into html source","bin":{"juice2":"./bin/juice"},"scripts":{"test":"mocha --reporter spec"},"engines":{"node":">=0.8.0"},"dependencies":{"cssom":"~0.3.0","jsdom":"~0.8.11","batch":"~0.5.0","superagent":"~0.16.0","commander":"~2.1.0","slick":"~1.10.4"},"devDependencies":{"should":"~3.0.1","expresso":"~0.9.2","mocha":"~1.17.1"},"repository":{"type":"git","url":"https://github.com/superjoe30/juice.git"},"bugs":{"url":"https://github.com/superjoe30/juice/issues"},"homepage":"https://github.com/superjoe30/juice","_id":"juice2@0.5.0","dist":{"shasum":"21b235890ad0a43e23444f4f5e258f9aaceb8bf8","tarball":"https://registry.npmjs.org/juice2/-/juice2-0.5.0.tgz","integrity":"sha512-94OLgEx2AbtwijZw09eU27TqdjldCEKr/R+ISY7WcZ/9vMVk31pyX+zzcDJmZR1bwJYbCynr7dBmDRF955q5Vw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBxR3VfAc7S5wqjPZSpTyMu2NW+w8I/q7GM9XbWAXMvgAiEAk50KT5Dt6BwAoujj4/QY5WqNm98DwsVAqyoAM2HUigQ="}]},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"superjoe","email":"superjoe30@gmail.com"},"maintainers":[{"name":"superjoe","email":"superjoe30@gmail.com"}]},"0.5.1":{"name":"juice2","version":"0.5.1","description":"Inlines css into html source","bin":{"juice2":"./bin/juice"},"scripts":{"test":"mocha --reporter spec"},"engines":{"node":">=0.10.20"},"dependencies":{"cssom":"~0.3.0","jsdom":"~0.8.11","batch":"~0.5.0","superagent":"~0.16.0","commander":"~2.1.0","slick":"~1.10.4"},"devDependencies":{"should":"~3.0.1","expresso":"~0.9.2","mocha":"~1.17.1"},"repository":{"type":"git","url":"https://github.com/andrewrk/juice.git"},"bugs":{"url":"https://github.com/andrewrk/juice/issues"},"homepage":"https://github.com/andrewrk/juice","_id":"juice2@0.5.1","dist":{"shasum":"0b97ca0323ab9dc79d3355d34a120456f6b1aeb7","tarball":"https://registry.npmjs.org/juice2/-/juice2-0.5.1.tgz","integrity":"sha512-SeyQ/nZk94C1INq5fbIg3guploJcWEwFr0aIPNbV6gCr/0tAXPCJMRc1AVQtcP8jLnz2UFUXvb0GXnQMny4Zzw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC12ES/hnQ1rBPHM2FyqgKvJEJH7Cl4mv1DiSgF9um9gQIgNCWcaJxWOJmFMkKJDfsGfi9rpLFR2S9mwgQDLI23uY0="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"superjoe","email":"superjoe30@gmail.com"},"maintainers":[{"name":"superjoe","email":"superjoe30@gmail.com"}]},"0.6.0":{"name":"juice2","version":"0.6.0","description":"Inlines css into html source","bin":{"juice2":"./bin/juice"},"scripts":{"test":"mocha --reporter spec"},"engines":{"node":">=0.10.20"},"dependencies":{"slick":"^1.11.1","batch":"^0.5.0","commander":"^2.2.0","cssom":"^0.3.0","superagent":"^0.17.0","jsdom":"^0.10.5"},"devDependencies":{"should":"^3.3.1","mocha":"^1.18.2","expresso":"^0.9.2"},"repository":{"type":"git","url":"https://github.com/andrewrk/juice.git"},"bugs":{"url":"https://github.com/andrewrk/juice/issues"},"homepage":"https://github.com/andrewrk/juice","_id":"juice2@0.6.0","dist":{"shasum":"4d6345226c4572355d29ed7379d40ba56d37bd9e","tarball":"https://registry.npmjs.org/juice2/-/juice2-0.6.0.tgz","integrity":"sha512-QJ11CGiT1SHHfGVpm9sRcsyYO38XhRkFaZkQuZAvlhPoczzbyiGW5UWuMTtwLETYzT4ZmgJBj1nByn8qEN5Jcw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQO+8pATin/CHEcfjMthGZfjLQahUCtrrPxEQXBcad6QIgXj0aUoNMn24gWptxcfjIxu16YNj8l4BLzhNT2P4pSXo="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"superjoe","email":"superjoe30@gmail.com"},"maintainers":[{"name":"superjoe","email":"superjoe30@gmail.com"}]},"0.7.0":{"name":"juice2","version":"0.7.0","description":"Inlines css into html source","bin":{"juice2":"./bin/juice"},"scripts":{"test":"mocha --reporter spec"},"engines":{"node":">=0.10.20"},"dependencies":{"slick":"^1.11.1","batch":"^0.5.0","commander":"^2.2.0","cssom":"^0.3.0","superagent":"^0.17.0","jsdom":"^0.10.5"},"devDependencies":{"should":"^3.3.1","mocha":"^1.18.2","expresso":"^0.9.2"},"repository":{"type":"git","url":"https://github.com/andrewrk/juice.git"},"bugs":{"url":"https://github.com/andrewrk/juice/issues"},"homepage":"https://github.com/andrewrk/juice","_id":"juice2@0.7.0","dist":{"shasum":"6fcaa5297d46b99164c9b77256e19a2549b47531","tarball":"https://registry.npmjs.org/juice2/-/juice2-0.7.0.tgz","integrity":"sha512-nr0Jw1F9SrQf1D8o9zkYb6vNgJ8SqEKLbcj2YZckFPMsSEQwylmNI79FZDMd0YdXSMrTQQe3CYkIyzikktGqFQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFaV6RR7DCbR5vkaoClH40hpyvM7bOkTGklvgLIEFm4BAiEAlnOr1JYbfIdVqbuniqtwV2SHivRQtLQjZgFtl/5psoY="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"superjoe","email":"superjoe30@gmail.com"},"maintainers":[{"name":"superjoe","email":"superjoe30@gmail.com"}]},"1.0.0":{"name":"juice2","version":"1.0.0","description":"Inlines css into html source","bin":{"juice2":"./bin/juice"},"scripts":{"test":"mocha --reporter spec"},"engines":{"node":">=0.10.20"},"dependencies":{"slick":"^1.11.1","batch":"^0.5.0","commander":"^2.2.0","cssom":"^0.3.0","superagent":"^0.17.0","jsdom":"^0.10.5"},"devDependencies":{"should":"^3.3.1","mocha":"^1.18.2","expresso":"^0.9.2"},"repository":{"type":"git","url":"https://github.com/andrewrk/juice.git"},"bugs":{"url":"https://github.com/andrewrk/juice/issues"},"homepage":"https://github.com/andrewrk/juice","_id":"juice2@1.0.0","dist":{"shasum":"96a35c8199b302039e970ec12e3167ca12a36bec","tarball":"https://registry.npmjs.org/juice2/-/juice2-1.0.0.tgz","integrity":"sha512-WS+Pbsa3NuFaMBdeI5n29MhanHzAkywJ7Yy2+6zEww0Mz+1UOIDnEJMsxFzsCo2Wbu49HrjIOkDfYmuvT7VoBw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICe787t5e/PeqUEMC/UhR3QnG31GGgxj+AVPjFPaJ4I7AiEAvUX4t76jBKzevvjntxgvpi8LLqV69NsOijvYVuFEqJQ="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"superjoe","email":"superjoe30@gmail.com"},"maintainers":[{"name":"superjoe","email":"superjoe30@gmail.com"}]},"1.1.0":{"name":"juice2","version":"1.1.0","description":"Inlines css into html source","bin":{"juice2":"./bin/juice"},"scripts":{"test":"mocha --reporter spec"},"engines":{"node":">=0.10.20"},"dependencies":{"slick":"^1.11.1","batch":"^0.5.0","commander":"^2.2.0","cssom":"^0.3.0","superagent":"^0.17.0","jsdom":"^0.10.5"},"devDependencies":{"should":"^3.3.1","mocha":"^1.18.2","expresso":"^0.9.2"},"repository":{"type":"git","url":"https://github.com/andrewrk/juice.git"},"bugs":{"url":"https://github.com/andrewrk/juice/issues"},"homepage":"https://github.com/andrewrk/juice","_id":"juice2@1.1.0","dist":{"shasum":"f87d0362e4b5e5837201f8a5d95607b996669431","tarball":"https://registry.npmjs.org/juice2/-/juice2-1.1.0.tgz","integrity":"sha512-Uh7bbKSoIIIArszBnvYOiOxOZdW4En4Q8eCaXiRI389p6ATAiJe4hR0msQnRma6RkvFX3x3b+SRe7u3qDkRkew==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFRj5siYyoeNLNvTwK/ElAPNiyrbMQSAwHH9BK8F1g/AAiB8RIeOeRUX/x1SVjDLOcBxJiUSjfJI5BSWMwRDj/MtrA=="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"superjoe","email":"superjoe30@gmail.com"},"maintainers":[{"name":"superjoe","email":"superjoe30@gmail.com"}]},"1.2.0":{"name":"juice2","version":"1.2.0","description":"Inlines css into html source","bin":{"juice2":"./bin/juice"},"scripts":{"test":"mocha --reporter spec"},"engines":{"node":">=0.10.20"},"dependencies":{"slick":"^1.11.1","batch":"^0.5.0","commander":"^2.2.0","cssom":"^0.3.0","superagent":"^0.17.0","jsdom":"^0.10.5"},"devDependencies":{"should":"^3.3.1","mocha":"^1.18.2","expresso":"^0.9.2"},"repository":{"type":"git","url":"https://github.com/andrewrk/juice.git"},"bugs":{"url":"https://github.com/andrewrk/juice/issues"},"homepage":"https://github.com/andrewrk/juice","_id":"juice2@1.2.0","dist":{"shasum":"59068ebbe7520805d7a0c1d7fccfeb8672c404e7","tarball":"https://registry.npmjs.org/juice2/-/juice2-1.2.0.tgz","integrity":"sha512-vibB2OrXKDccOYVKKz/ZmnpQR2mjheTaSSUrcgtaVH5vzinG52T+4l7wktjlVOGPX0KYWHLz66lHeBfhLb8Nlg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICrfNwosAbEFBtf4EDUmxcf/CtA9uTABMdYy86bjQmpMAiEA6ui5W2nl9jGMePliZgt9OtHfU+7iRqw/5MIIsE6kKVc="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"superjoe","email":"superjoe30@gmail.com"},"maintainers":[{"name":"superjoe","email":"superjoe30@gmail.com"}]},"1.3.0":{"name":"juice2","version":"1.3.0","description":"Inlines css into html source","bin":{"juice2":"./bin/juice"},"scripts":{"test":"mocha --reporter spec"},"engines":{"node":">=0.10.20"},"dependencies":{"slick":"~1.12.1","commander":"~2.3.0","cssom":"~0.3.0","superagent":"~0.18.2","jsdom":"~0.11.1","pend":"~1.1.2"},"devDependencies":{"should":"~4.0.4","mocha":"~1.20.1","expresso":"~0.9.2"},"repository":{"type":"git","url":"https://github.com/andrewrk/juice.git"},"bugs":{"url":"https://github.com/andrewrk/juice/issues"},"_id":"juice2@1.3.0","dist":{"shasum":"eeacc53b95e34f2e019f57d8cb1d3a387b4db6d3","tarball":"https://registry.npmjs.org/juice2/-/juice2-1.3.0.tgz","integrity":"sha512-GAB4PKNAyy5KJoRB2g77kTCkwTVFS4t9xAP4/WjPpHZUkRPXQ+wb2COqIGsBqMMGV2Lr0I0BIyByPPcNnNmv5A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHmGQqHKFF9ZpD1RxCHGXscdsG3mjg0hA4mN7oZzB9DDAiEAwNLzBgrlEoEDYDOVX0ovI7A3y8ZtTZi2HHLi4xUwcYM="}]},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"superjoe","email":"superjoe30@gmail.com"},"maintainers":[{"name":"superjoe","email":"superjoe30@gmail.com"}]},"1.3.1":{"name":"juice2","version":"1.3.1","description":"Inlines css into html source","bin":{"juice2":"./bin/juice"},"scripts":{"test":"mocha --reporter spec"},"engines":{"node":">=0.10.20"},"dependencies":{"slick":"~1.12.1","commander":"~2.3.0","cssom":"~0.3.0","superagent":"~0.18.2","jsdom":"~0.11.1","pend":"~1.1.2"},"devDependencies":{"should":"~4.0.4","mocha":"~1.20.1","expresso":"~0.9.2"},"repository":{"type":"git","url":"https://github.com/andrewrk/juice.git"},"bugs":{"url":"https://github.com/andrewrk/juice/issues"},"homepage":"https://github.com/andrewrk/juice","_id":"juice2@1.3.1","dist":{"shasum":"15c99929fdb49728a5b4fb41e9b1306739c19ec4","tarball":"https://registry.npmjs.org/juice2/-/juice2-1.3.1.tgz","integrity":"sha512-Em1P9uxXhvJUSP65cH5lylg1H286nej2vFSMJXoSqTE7N7mFeFTYGZrANLw9JFwiwk4gOw0LD0K3ysTTvU3x2w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDyyNqPB7rnzsj4rGLn45O83P+iiZEcFqGJbvsHcwHbbQIgJir2yrVjS7iJswa16zNyd60A8c35mU4pU4QZWZt1cTo="}]},"_from":"./","_npmVersion":"1.4.3","_npmUser":{"name":"jrit","email":"jarrett@24m2.com"},"maintainers":[{"name":"superjoe","email":"superjoe30@gmail.com"},{"name":"jrit","email":"jarrett@24m2.com"}]}},"readme":"[![Build Status](https://travis-ci.org/andrewrk/juice.png?branch=master)](https://travis-ci.org/andrewrk/juice)\r\n# Juice ![](http://i.imgur.com/jN8Ht.gif)\r\n\r\nGiven HTML, juice will inline your CSS properties into the `style`\r\nattribute.\r\n\r\n## How to use\r\n\r\n```js\r\nvar juice = require('juice2');\r\njuice(\"/path/to/file.html\", function(err, html) {\r\n  console.log(html);\r\n});\r\n```\r\n\r\n`/path/to/file.html`:\r\n```html\r\n<html>\r\n<head>\r\n  <style>\r\n    p { color: red; }\r\n  </style>\r\n  <link rel=\"stylesheet\" href=\"style.css\">\r\n</head>\r\n<body>\r\n  <p>Test</p>\r\n</body>\r\n</html>\r\n```\r\n\r\n`style.css`\r\n```css\r\np {\r\n  text-decoration: underline;\r\n}\r\n```\r\n\r\nOutput:\r\n```html\r\n<html>\r\n<head>\r\n</head>\r\n<body>\r\n  <p style=\"color: red; text-decoration: underline;\">Test</p>\r\n</body>\r\n</html>\r\n```\r\n\r\n## What is this useful for ?\r\n\r\n- HTML emails. For a comprehensive list of supported selectors see\r\n[here](http://www.campaignmonitor.com/css/)\r\n- Embedding HTML in 3rd-party websites.\r\n\r\n## Projects using juice\r\n\r\n* [node-email-templates][1] - Node.js module for rendering beautiful emails with [ejs][2] templates and email-friendly inline CSS using [juice][3].\r\n* [swig-email-templates][4] - Uses [swig][5], which gives you [template inheritance][6], and\r\n  can generate a [dummy context][7] from a template.\r\n\r\n[1]: https://github.com/niftylettuce/node-email-templates\r\n[2]: https://github.com/visionmedia/ejs\r\n[3]: https://github.com/LearnBoost/juice\r\n[4]: https://github.com/andrewrk/swig-email-templates\r\n[5]: https://github.com/paularmstrong/swig\r\n[6]: https://docs.djangoproject.com/en/dev/topics/templates/#template-inheritance\r\n[7]: https://github.com/andrewrk/swig-dummy-context\r\n\r\n## Documentation\r\n\r\n### juice(filePath, [options], callback)\r\n\r\n * `filePath` - html file\r\n * `options` - (optional) object containing these properties:\r\n   - `extraCss` - extra css to apply to the file. Defaults to `\"\"`.\r\n   - `applyStyleTags` - whether to inline styles in `<style></style>`\r\n     Defaults to `true`.\r\n   - `applyLinkTags` [Deprecated, use applyLinksToStyleTags] - whether to resolve `<link rel=\"stylesheet\">` tags\r\n     and inline the resulting styles into document `head`. Defaults to `true`.\r\n   - `applyLinksToStyleTags` - whether to resolve `<link rel=\"stylesheet\">` tags\r\n     and replace them with `style` tags. This works with `preserveMediaQueries` \r\n     unlike the deprecated `applyLinkTags`. Defaults to `true`.\r\n   - `removeStyleTags` - whether to remove the original `<style></style>`\r\n     tags after (possibly) inlining the css from them. Defaults to `true`.\r\n   - `preserveMediaQueries` - preserves all media queries (and contained styles) \r\n     within `<style></style>` tags as a refinement when `removeStyleTags` is `true`. \r\n     Other styles are removed. Defaults to `false`.\r\n   - `applyWidthAttributes` - whether to use any CSS pixel widths to create\r\n     `width` attributes on elements set in `juice.widthElements`\r\n   - `removeLinkTags` - whether to remove the original `<link rel=\"stylesheet\">`\r\n     tags after (possibly) inlining the css from them. Defaults to `true`.\r\n   - `url` - how to resolve hrefs. Defaults to using `filePath`. If you want\r\n     to override, be sure your `url` has the protocol at the beginning, e.g.\r\n     `http://` or `file://`.\r\n * `callback(err, html)`\r\n   - `err` - `Error` object or `null`.\r\n   - `html` - contains the html from `filePath`, with potentially `<style>` and\r\n     `<link rel=\"stylesheet\">` tags removed, and css inlined.\r\n\r\n### juice.juiceContent(html, options, callback)\r\n\r\n * `html` - raw html content\r\n * `options` - same options as calling `juice`, except now `url` is required.\r\n * `callback(err, html)` - same as calling `juice`\r\n\r\n### juice.juiceDocument(document, options, callback)\r\n\r\nOperates on a jsdom instance. Be sure to use the same jsdom version that juice\r\nuses. Also be sure to clean up after you are done. You may have to\r\ncall `document.parentWindow.close()` to free up memory.\r\n\r\n * `document` - a jsdom instance\r\n * `options` - see `juice.juiceContent`\r\n * `callback(err)`\r\n\r\n### juice.inlineContent(html, css)\r\n\r\nThis takes html and css and returns new html with the provided css inlined.\r\nIt does not look at `<style>` or `<link rel=\"stylesheet\">` elements at all.\r\n\r\n### juice.inlineDocument(document, css, options)\r\n\r\nGiven a jsdom instance and css, this modifies the jsdom instance so that the\r\nprovided css is inlined. It does not look at `<style>` or\r\n`<link rel=\"stylesheet\">` elements at all.\r\n\r\n### juice.ignoredPseudos\r\n\r\nArray of ignored pseudo-selectors such as 'hover' and 'active'.\r\n\r\n### juice.widthElements\r\n\r\nArray of HTML elements that can receive `width` attributes.\r\n\r\n### 3rd-party\r\n\r\n- Uses the excellent [JSDom](http://github.com/tmpvar/jsdom) for the underlying DOM\r\nrepresentation.\r\n- Uses [cssom](https://github.com/NV/CSSOM) to parse out CSS selectors and\r\n[Slick](http://github.com/subtleGradient/slick) to tokenize them.\r\n- Icon by [UnheardSounds](http://unheardsounds.deviantart.com/gallery/26536908#/d2ngozi)\r\n","maintainers":[{"name":"superjoe","email":"superjoe30@gmail.com"},{"name":"jrit","email":"jarrett@24m2.com"}],"time":{"modified":"2022-06-19T07:17:36.563Z","created":"2014-01-23T05:21:08.712Z","0.5.0":"2014-01-23T05:21:08.712Z","0.5.1":"2014-03-12T17:24:42.615Z","0.6.0":"2014-04-25T17:55:28.031Z","0.7.0":"2014-05-06T17:41:18.114Z","1.0.0":"2014-05-07T20:44:10.731Z","1.1.0":"2014-05-22T20:08:38.088Z","1.2.0":"2014-05-27T20:44:47.485Z","1.3.0":"2014-07-22T20:48:58.788Z","1.3.1":"2014-11-25T02:59:15.271Z"},"readmeFilename":"README.md","repository":{"type":"git","url":"https://github.com/andrewrk/juice.git"},"bugs":{"url":"https://github.com/andrewrk/juice/issues"},"users":{"jonkemp":true,"davidhalldor":true,"favasconcelos":true,"cascadejs":true,"rubiadias":true,"mrbgit":true,"ongoworks":true,"sanmai":true,"ariestav":true,"bvfbarten":true},"homepage":"https://github.com/andrewrk/juice"}