mirror of
https://github.com/danog/inline-critical.git
synced 2024-11-30 04:29:07 +01:00
minor fixes
This commit is contained in:
parent
125c1aa16f
commit
3a56a2d3e2
5
index.js
5
index.js
@ -72,7 +72,8 @@ function getIndent(html, $el) {
|
||||
}
|
||||
|
||||
module.exports = function (html, styles, options) {
|
||||
var $ = cheerio.load(String(html), {
|
||||
html = String(html);
|
||||
var $ = cheerio.load(html, {
|
||||
decodeEntities: false
|
||||
});
|
||||
|
||||
@ -112,7 +113,7 @@ module.exports = function (html, styles, options) {
|
||||
// insert inline styles right before first <link rel="stylesheet" />
|
||||
$target.before([
|
||||
'<style type="text/css">',
|
||||
indent + styles,
|
||||
indent + styles.replace(/(\r\n|\r|\n)/g,'$1' + targetIndent + indent),
|
||||
'</style>', ''
|
||||
].join('\n' + targetIndent));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user