Added support for html being a string or filename. Added tests. Updated dependencies. Updated docs.

This commit is contained in:
Alexandre Gigliotti
2015-08-26 10:31:29 -07:00
parent 251431a110
commit 0bd64b1308
16 changed files with 191 additions and 72 deletions

View File

@@ -6,12 +6,25 @@ var inlineStyle = require('./inline-style');
var inlineImg = require('./inline-img');
var inlineLinkLess = require('./inline-link-less');
var inline = co.wrap(function * (filename, options) {
var inline = co.wrap(function * (html, options) {
options = _.defaults(options || {}, {
filename: null,
less: {},
verbose: false
});
var html = yield fs.readFile(filename, 'utf8');
var filename;
try {
filename = html;
html = yield fs.readFile(filename, 'utf8');
}
catch (error) {
if (error.code === 'ENOENT') {
filename = options.filename;
}
else {
throw error;
}
}
var files = [filename];
// Inline links