Skip to content

Commit 508b08f

Browse files
authored
Merge pull request #132 from posthtml/feat/types
2 parents 3ce3224 + aef5117 commit 508b08f

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

license renamed to LICENSE

File renamed without changes.

readme.md renamed to README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<img width="150" height="150" title="PostHTML" src="https://posthtml.github.io/posthtml/logo.svg">
3-
<h1>Merge inline longhand</h1>
3+
<h1>Merge Longhand</h1>
44
<p>Merge longhand inline CSS into shorthand</p>
55

66
[![Version][npm-version-shield]][npm]

index.d.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
export type PluginOptions = {
2+
/**
3+
Array of tag names to process. All other tags will be skipped.
4+
5+
@default []
6+
7+
@example
8+
```js
9+
const posthtml = require('posthtml')
10+
const mergeInlineLonghand = require('posthtml-postcss-merge-longhand')
11+
12+
const html = `
13+
<div style="margin: 0; margin-top: 20px;"></div>
14+
<p style="margin: 0; margin-top: 10px;"></p>
15+
`
16+
17+
posthtml([
18+
mergeInlineLonghand({tags: ['div']})
19+
])
20+
.process(html)
21+
.then(result => console.log(result.html))
22+
23+
// Result:
24+
// <div style="margin: 0; margin-top: 20px;"></div>
25+
// <p style="margin: 0; margin-top: 10px;"></p>
26+
```
27+
*/
28+
tags?: string[];
29+
};

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"homepage": "https://github.com/posthtml/posthtml-postcss-merge-longhand",
99
"repository": "posthtml/posthtml-postcss-merge-longhand",
1010
"main": "lib",
11+
"types": "index.d.ts",
1112
"engines": {
1213
"node": ">=14.0.0"
1314
},
@@ -41,6 +42,7 @@
4142
"xo": "^0.54.2"
4243
},
4344
"files": [
44-
"lib/*"
45+
"lib/*",
46+
"index.d.ts"
4547
]
4648
}

0 commit comments

Comments
 (0)