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
+160-2
Original file line number
Diff line number
Diff line change
@@ -92,9 +92,167 @@ Result:
92
92
|**matcher**|`[]`| Array of object used to match the tags. Useful if you are migrating from extend and modules. |
93
93
|**strict**|`true`| Boolean value for enable or disable throw an exception. |
94
94
95
-
## Feature
95
+
## Features
96
96
97
-
TODO...
97
+
### Tag names and x-tags
98
+
99
+
You can use the components in multiple ways, or also a combination of them.
100
+
Like with `posthtml-extend` and `posthtml-modules` you can define a tag name or multiples tag name in combination with an attribute name or multiple attributes name for set the path to the components.
101
+
102
+
For example for the same button component `src/button.html` in the basic example we can define the tag name and attribute name and then use it in this way:
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.
128
+
129
+
Init PostHTML with multiple tag names and attributes:
If you need more control over how to match the tags, you can pass directly an array of matcher or single object via `options.matcher` like shown in below example:
If your components are in a subfolder then you can use `dot` to access it, example:
199
+
200
+
```html
201
+
<!-- Supposing your button component is located in ./src/components/forms/button.html -->
202
+
<x-forms.button>Submit</x-forms.button>
203
+
```
204
+
205
+
If your components are in a sub-folder with multiple files, then for avoid to type the main file you can use `index.html` without specify it.
206
+
Please see below example to understand better.
207
+
208
+
```html
209
+
<!-- Supposing your modal component is located in ./src/components/modals/index.html -->
210
+
<x-modal.index>Submit</x-modal.index>
211
+
212
+
<!-- You can omit "index" part since the file is named "index.html" -->
213
+
<x-modal>Submit</x-modal>
214
+
```
215
+
216
+
### Multiple roots
217
+
218
+
You have full control where to place your components. Once you set the main root path of your components, you can then set multiple roots.
219
+
For example let's suppose your main root is `./src` and then you have several folders where you have your components, for example `./src/components` and `./src/layouts`.
0 commit comments