npm i -D posthtml-style-to-file
Type: String
Default: ./result.css
Description: Destination path, where the extracted CSS is saved to.
Type: String
Default: ``
Description: Removes the specified value attrs
| `tag` | `all`
removeStyle
Destination path, where the extracted CSS is saved to.
const posthtml = require('posthtml')
const styleToFile = require('posthtml-style-to-file')
const html = readFileSync('path/to/html', 'utf8')
posthtml([ styleToFile({ path: './dist/style.css' }) ])
.process(html)
.then((result) => console.log(result.html))
index.html
<html>
<head>
<title>Wow</title>
<style type="text/css">
html { margin: 0 }
</style>
</head>
<body style="background: #fff;">
<div class="button" style="border: 1px solid #000;">
<div class="button__text">
Text
</div>
</div>
</body>
</html>
style.css
html{ margin: 0 }
body{ background: #fff; }
div.button{ border: 1px solid #000; }