https://github.com/posthtml/posthtml-class-to-css-module
A posthtml plugin for clone class to attribute css-module
https://github.com/posthtml/posthtml-class-to-css-module
clone css css-modules modules posthtml posthtml-plugin
Last synced: 11 months ago
JSON representation
A posthtml plugin for clone class to attribute css-module
- Host: GitHub
- URL: https://github.com/posthtml/posthtml-class-to-css-module
- Owner: posthtml
- License: mit
- Created: 2017-03-20T11:48:01.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-15T09:41:03.000Z (almost 8 years ago)
- Last Synced: 2024-10-29T21:06:04.197Z (over 1 year ago)
- Topics: clone, css, css-modules, modules, posthtml, posthtml-plugin
- Language: JavaScript
- Size: 85.9 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license
Awesome Lists containing this project
README
# posthtml-class-to-css-module
> A [posthtml](https://github.com/posthtml) A posthtml plugin for clone `class` to attribute `css-module`
[](https://travis-ci.org/posthtml/posthtml-class-to-css-module)[]()[](https://www.npmjs.com/package/posthtml-class-to-css-module)[](https://david-dm.org/gitscrum/posthtml-class-to-css-module)[](https://github.com/sindresorhus/xo)[](https://coveralls.io/r/posthtml/posthtml-class-to-css-module)
[](https://www.npmjs.com/package/posthtml-class-to-css-module)[](https://www.npmjs.com/package/posthtml-class-to-css-module)
## Why?
The plugin for cloning classes in the attribute `css-module` when used together with [posthtml-css-modules](https://github.com/posthtml/posthtml-css-modules)
## Install
```bash
npm i -D posthtml posthtml-class-to-css-module
```
> **Note:** This project is compatible with node v4+
## Usage
```js
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`
## Example
#### input.html
```html
```
#### output.html
```html
```
## Options
### `removeClass`
Type: `Boolean`
Default: false
Description: *Removes the `class` attribute after cloning the `class` value to an attribute `css-module`*