1.1.5 • Published 10 years ago
inlinecss v1.1.5
inlineCSS
A NodeJS package for inlining external stylesheets and embedded style tags into html content.
Install
npm install inlinecss
Usage
var inlineCSS = require('inlinecss');
var html = inlineCSS.inlineHtml('<style>p{height:50px;}</style><p>Text</p>');Methods
inlineHtml(html, options, callback)
Inlines raw html content
html- Raw htmloptions- See Options belowcallback- FunctioninlineCSS.inlineHtml(html, function(inlineHtml) { console.log(inlineHtml); });
Returns inlined html as an argument.
inlineFile(inFile, outFile, options, callback)
Creates an inlined html file
inFile- Location of file to be inlinedoutFile- Destination of generated fileoptions- See Options belowcallback- FunctioninlineCSS.inlineFile(inFile, outFile, function() { console.log('success'); });
No return arguments.
Options
options.cssRoot
Define an optional base directory for external stylesheets
Type: String
Default: ''
options.decodeEntities
Decode HTML entities. Eg: & -> &
Type: Boolean
Default: true
options.inlineStyleTags
Inline content in <style> tags found in the HTML document
Type: Boolean
Default: true
options.removeAttributes
Remove class and id attributes
Provide keepattr in the attribute value to prevent an attribute from being removed.
Type: Boolean
Default: true
Dependencies
License
MIT © Rɪpəl Labs