Inline css into html dom
It is very simple right now
It is based on fritx/css-obj
Source:
<!-- only one tag that wraps -->
<!-- to which body/html will be
implicitly auto-parented
while inlining -->
<div class="box">
<img src="https://github.com/fritx/css-inline/raw/master/xxx">
</div>
.box {
background-color: blue;
}
body > .box {
color: red;
}
.box img {
width: 100%;
height: auto;
}
Inlining:
var inlineCss = require('css-inline')
inlineCss(html, css, function(err, inlined){
console.log(inlined)
})
Outputs:
<div class="box" style="background-color:blue;color:red;">
<img src="https://github.com/fritx/css-inline/raw/master/xxx" style="width:100%;height:auto;">
</div>