You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

boost

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

boost - npm Package Compare versions

Comparing version

to
0.0.1

test/html/remote_url.in.html

4

index.js

@@ -5,3 +5,3 @@ var jsdom = require("jsdom")

, juice = require('juice')
, url = require('juice')
, url = require('url')
, superagent = require('superagent')

@@ -33,3 +33,3 @@ , assert = require('assert')

try {
cb(null, juice(html, css));
cb(null, juice(html, css).trim());
} catch (err) {

@@ -36,0 +36,0 @@ cb(err);

{
"name": "boost",
"version": "0.0.0",
"version": "0.0.1",
"description": "inline css into your html",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,4 +0,52 @@

boost
=====
# boost ![](http://i.imgur.com/fSEY9.gif)
juice on steroids
Given HTML, boost will inline your CSS properties into the `style` attribute.
## How to use
```js
var boost = require('boost');
boost("/path/to/file.html", function(err, html) {
console.log(html);
});
```
`/path/to/file.html`:
```html
<html>
<head>
<style>
p { color: red; }
</style>
<link rel="stylesheet" href="style.css">
</head>
<body>
<p>Test</p>
</body>
</html>
```
`style.css`
```css
p {
text-decoration: underline;
}
```
Output:
```
<p style="color: red; text-decoration: underline;">Test</p>
```
## What is this useful for ?
- HTML emails. See [juice](https://github.com/LearnBoost/juice)
- Embedding HTML in 3rd-party websites.
## Why not just use juice ?
Because then you cannot take advantage of template inheritance with your css.
## Projects using boost
- none yet

@@ -9,2 +9,4 @@ var boost = require('../')

"no_css": true,
"two_styles": true,
"remote_url": true,
};

@@ -16,14 +18,14 @@ describe("boost", function() {

function createIt(templateName) {
function createIt(testName) {
return function(cb) {
var batch = new Batch();
batch.push(function(cb) {
fs.readFile(path.join(__dirname, "html", testName + ".out.html"), 'utf8', cb);
boost(path.join(__dirname, "html", testName + ".in.html"), cb);
});
batch.push(function(cb) {
boost(path.join(__dirname, "html", testName + ".in.html"), cb);
fs.readFile(path.join(__dirname, "html", testName + ".out.html"), 'utf8', cb);
});
batch.end(function(err, results) {
if (err) return cb(err);
assert.strictEqual(results[0], results[1]);
assert.strictEqual(results[0], results[1].trim());
cb();

@@ -30,0 +32,0 @@ });