A posthtml A posthtml plugin for clone
class
to attributecss-module
The plugin for cloning classes in the attribute css-module
when used together with posthtml-css-modules
npm i -D posthtml posthtml-class-to-css-module
Note: This project is compatible with node v4+
import {readFileSync, writeFileSync} from 'fs';
import posthtml from 'posthtml';
import clone from 'posthtml-class-to-css-module';
const html = readFileSync('input.html', 'utf8');
posthtml()
.use(clone())
.process(html)
.then(result => {
writeFileSync('output.html', result.html);
});
Returns the html with cloned classes in the attribute css-module
<!DOCTYPE html>
<html>
<head></head>
<body class="class-for-body"></body>
</html>
<!DOCTYPE html>
<html>
<head></head>
<body class="class-for-body" css-module="class-for-body"></body>
</html>
Type: Boolean
Default: false
Description: Removes the class
attribute after cloning the class
value to an attribute css-module