You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: readme.md
+33-1
Original file line number
Diff line number
Diff line change
@@ -116,6 +116,7 @@ You can run `npm run build` to compile them.
116
116
|**propsContext**|`props`| String value used as object name inside the script to process process before passed to the component. |
117
117
|**propsAttribute**|`props`| String value for props attribute to define props as JSON. |
118
118
|**propsSlot**|`props`| String value used to retrieve the props passed to slot via `$slots.slotName.props`. |
119
+
|**parserOptions**|`{recognizeSelfClosing: true}`| Object to configure `posthtml-parser`. By default, it enables support for self-closing component tags. |
119
120
|**expressions**|`{}`| Object to configure `posthtml-expressions`. You can pre-set locals or customize the delimiters for example. |
120
121
|**plugins**|`[]`| PostHTML plugins to apply for every parsed components. |
121
122
|**matcher**|`[{tag: options.tagPrefix}]`| Array of object used to match the tags. |
@@ -216,6 +217,37 @@ Please see below example to understand better.
216
217
<x-modal>Submit</x-modal>
217
218
```
218
219
220
+
#### Parser options
221
+
222
+
You may pass options to `posthtml-parser` via `options.parserOptions`.
Important: as you can see, whatever `parserOptions` you pass to the plugin, must also be passed in the `process` method in your code, otherwise your PostHTML build will use `posthtml-parser` defaults and will override anything you've passed to `posthtml-component`.
237
+
238
+
#### Self-closing tags
239
+
240
+
The plugin supports self-closing tags by default, but you need to make sure to enable them in the `process` method in your code too, by passing `recognizeSelfClosing: true` in the options object:
If you don't add this to `process`, PostHTML will use `posthtml-parser` defaults and will not support self-closing component tags. This will result in everything after a self-closing tag not being output.
250
+
219
251
### Multiple folders
220
252
221
253
You have full control where to place your components. Once you set the base root path of your components, you can then set multiple folders.
0 commit comments