Merge longhand inline CSS properties into shorthand with PostCSS.
npm install posthtml-postcss-merge-longhandMerge longhand inline CSS into shorthand
style="" attributes to shorthand.
html
Test
`
Output:
`html
Test
`
Install
`
$ npm i posthtml posthtml-postcss-merge-longhand
`
Usage
`js
import posthtml from 'posthtml'
import mergeInlineLonghand from 'posthtml-postcss-merge-longhand'
const html = 'Test'
posthtml([
mergeInlineLonghand()
])
.process(html)
.then(result => console.log(result.html))
// Test
`
$3
Both ESM and CJS exports are provided, you can also require the module:
`js
const posthtml = require('posthtml')
const mergeInlineLonghand = require('posthtml-postcss-merge-longhand')
// ...
`
Options
$3
Type: array\
Default: []
Array of tag names to process. All other tags will be skipped.
Example:
`js
import posthtml from 'posthtml'
import mergeInlineLonghand from 'posthtml-postcss-merge-longhand'
const html =
Test
posthtml([
mergeInlineLonghand({tags: ['div']})
])
.process(html)
.then(result => console.log(result.html))
// Test
// Test
``