Skip to content

Commit

Permalink
Merge pull request #132 from posthtml/feat/types
Browse files Browse the repository at this point in the history
  • Loading branch information
cossssmin authored Feb 24, 2024
2 parents 3ce3224 + aef5117 commit 508b08f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion readme.md → README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<img width="150" height="150" title="PostHTML" src="https://posthtml.github.io/posthtml/logo.svg">
<h1>Merge inline longhand</h1>
<h1>Merge Longhand</h1>
<p>Merge longhand inline CSS into shorthand</p>

[![Version][npm-version-shield]][npm]
Expand Down
29 changes: 29 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export type PluginOptions = {
/**
Array of tag names to process. All other tags will be skipped.
@default []
@example
```js
const posthtml = require('posthtml')
const mergeInlineLonghand = require('posthtml-postcss-merge-longhand')
const html = `
<div style="margin: 0; margin-top: 20px;"></div>
<p style="margin: 0; margin-top: 10px;"></p>
`
posthtml([
mergeInlineLonghand({tags: ['div']})
])
.process(html)
.then(result => console.log(result.html))
// Result:
// <div style="margin: 0; margin-top: 20px;"></div>
// <p style="margin: 0; margin-top: 10px;"></p>
```
*/
tags?: string[];
};
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"homepage": "https://github.com/posthtml/posthtml-postcss-merge-longhand",
"repository": "posthtml/posthtml-postcss-merge-longhand",
"main": "lib",
"types": "index.d.ts",
"engines": {
"node": ">=14.0.0"
},
Expand Down Expand Up @@ -41,6 +42,7 @@
"xo": "^0.54.2"
},
"files": [
"lib/*"
"lib/*",
"index.d.ts"
]
}

0 comments on commit 508b08f

Please sign in to comment.