Skip to content

Commit 03f2e2f

Browse files
Fix typo readme
1 parent 2201df2 commit 03f2e2f

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

readme.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,10 @@ Init PostHTML:
114114

115115
```js
116116
// index.js
117-
const { readFileSync, writeFileSync } = require('fs')
118-
119-
const posthtml = require('posthtml')
120-
const components = require('posthtml-components')
121117

122-
posthtml(components({ root: './src', tagName: 'component', attribute: 'src' }))
123-
.process(readFileSync('src/index.html', 'utf8'))
124-
.then((result) => writeFileSync('dist/index.html', result.html, 'utf8'))
118+
require('posthtml')(require('posthtml-components')({ root: './src', tagName: 'component', attribute: 'src' }))
119+
.process(/* ... */)
120+
.then(/* ... */)
125121
```
126122

127123
We can also set multiple tag names by passing an array of component name and an array of attribute name, this is useful if you need to migrate from `posthtml-extend` and `posthtml-modules` where you are using different tag name.
@@ -144,7 +140,7 @@ Init PostHTML with multiple tag names and attributes:
144140
const options = {
145141
root: './src',
146142
tagNames: ['extends', 'module'],
147-
attribute: ['src', 'href']
143+
attributes: ['src', 'href']
148144
};
149145

150146
require('posthtml')(require('posthtml-components')(options))

0 commit comments

Comments
 (0)