Skip to content

Instantly share code, notes, and snippets.

@rosado
Created November 17, 2016 20:15
Show Gist options
  • Save rosado/26b86dbe13219249f99e6568c0a9fc55 to your computer and use it in GitHub Desktop.
Save rosado/26b86dbe13219249f99e6568c0a9fc55 to your computer and use it in GitHub Desktop.
inline-css
var options = {
'url': '/foo/bar/'
}
var inlineCss = require('inline-css')
var fs = require('fs')
fs.readFile('/Users/foo/Downloads/index.htm', 'utf8', function (err, data){
if (err){
return console.log(err);
}
inlineCss(data, options).then(function(html) {
console.log(html);
fs.writeFile('/Users/foo/Downloads/generated.htm', html, function (err) {
console.log(err);
})
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment