An open API service indexing awesome lists of open source software.

https://github.com/shimech/posthtml-css-prop

PostHTML Plugin to Support css prop like emotion
https://github.com/shimech/posthtml-css-prop

html posthtml posthtml-plugin

Last synced: 2 months ago
JSON representation

PostHTML Plugin to Support css prop like emotion

Awesome Lists containing this project

README

          

# @shimech/posthtml-css-prop

[![npm version](https://badge.fury.io/js/@shimech%2Fposthtml-css-prop.svg)](https://badge.fury.io/js/@shimech%2Fposthtml-css-prop)
![Test](https://github.com/shimech/posthtml-css-prop/actions/workflows/test.yml/badge.svg)

[PostHTML](https://github.com/posthtml/posthtml) plugin to support [css prop](https://emotion.sh/docs/css-prop) like emotion.
This package is a wrapper of [emotion](https://emotion.sh).

Before:

```html



Title



Hello World!

```

After:

```html



.css-1pwdwr4 {
text-align: center;
font-size: 24px;
}


.css-1q8jsgx {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}


.css-qrwk6l {
color: red;
}
.css-qrwk6l:hover {
color: blue;
}



Title



Hello World!

```

## Install

```shell
npm install @shimech/posthtml-css-prop
```

## Usage

```javascript
const posthtml = require("posthtml");
const html = `



Title



Hello World!



`;

posthtml()
.use(require("@shimech/posthtml-css-prop")())
.process(html)
.then((result) => console.log(result.html));
// Output:
//
// .css-1pwdwr4{text-align:center;font-size:24px;}.css-1q8jsgx{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}.css-qrwk6l{color:red;}.css-qrwk6l:hover{color:blue;}
//
//

Title


//

// Hello World!
//

//
//
```

### Contributing

See [PostHTML Guidelines](https://github.com/posthtml/posthtml/tree/master/docs).