Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Condon committed Feb 27, 2012
1 parent bf956ae commit 314ccf6
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 20 deletions.
53 changes: 45 additions & 8 deletions README.md
Expand Up @@ -7,6 +7,8 @@
- http://www.campaignmonitor.com/css/
- http://www.campaignmonitor.com/downloads/documents-tools/campaign-monitor-guide-to-css-in-email-sept-2011.pdf



### Requirements

- [Node.js](http://nodejs.org/)
Expand All @@ -18,31 +20,66 @@ npm install emailify -g
```


### Command Line Example
### Command Line

```bash
emailify -i /my/html/file.html -o /my/html/emailified.html
```

### JavaScript Example
### HTML Example

Turns this:

```html
<html>
<head>
<style>
h4 {
color: #ff6600;
}
</style>
</head>
<body>
<h4>orange header</h4>
</body>
</html>
```

Into this:
```html
<html>
<head>

</head>
<body>
<h4 style="color: #ff6600;">orange header</h4>
</body>
</html>
```


```javascript
var emailify = require('emailify'),
fs = require('fs')

emailify.parse(fs.readFileSync('/my/email/newsletter.html', 'utf8'), function(err, content) {
//send newsletter
});
```
### API
#### .load(file, callback)
loads a html file
#### .parse(content, callback)
parses html content into email-safe html
```javascript
var emailify = require('emailify'),
fs = require('fs')
emailify.parse(fs.readFileSync('/my/email/newsletter.html', 'utf8'), function(err, content) {
//send newsletter
});
6 changes: 3 additions & 3 deletions bin/emailify
Expand Up @@ -2,9 +2,9 @@

var argv = require('optimist').
usage('-i [input_html] -o [output_html]').
demand(['i','o']).
demand('i').
alias('i','input').
alias('o','output').
alias('','output').
argv;

var fs = require('fs'),
Expand All @@ -21,5 +21,5 @@ var on = outcome.error(function(err) {
});

emailify.load(fixFile(argv.i), { test: true }, on.success(function(content) {
fs.writeFile(fixFile(argv.o), content, on);
if(argv.o) fs.writeFile(fixFile(argv.o), content, on);
}));
8 changes: 0 additions & 8 deletions examples/test-1/index.html
Expand Up @@ -6,14 +6,6 @@
box-shadow: #ff6600;
}

a:hover {

}

b:hover {

}

</style>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion lib/test/compatibility/test-iphone-ipad.js
Expand Up @@ -5,7 +5,7 @@ module.exports = {

'Apple iPhone/iPad - 16%': {

'Selectors': utils.doesNotContainStylesBatch(
'styles': utils.doesNotContainStylesBatch(

//BOX
'box-shadow',
Expand Down

0 comments on commit 314ccf6

Please sign in to comment.