Skip to content

Commit

Permalink
docs: add attribute/value to locals, #76
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum committed Dec 1, 2021
1 parent 2b49df4 commit 5a79b35
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ Pass data to the module.

If present, the JSON object from the `locals=""` attribute will be merged on top of this, overwriting any existing values.

### `attributeAsLocals`

Type: `boolean`\
Default: `false`

All attributes on `<module></module>` will be added to [locals](#locals)

### `parser`

Type: `object`\
Expand Down Expand Up @@ -154,6 +161,39 @@ Example:
<p>Or so they say...</p>
```

### `attributeAsLocals`

All attributes on `<module></module>` will be added to [locals](#locals)

Example:

```handlebars
<!-- module.html -->
<div class="{{ class }}" id="{{ id }}" style="{{ style }}">
<content></content>
</div>
```

```handlebars
<!-- index.html -->
<module
href="module.html"
class="text-center uppercase"
id="example"
style="display: flex; gap: 2;"
>
Module content
</module>
```

### Result

```html
<div class="text-center uppercase" id="example" style="display: flex; gap: 2;">
Module content
</div>
```

[npm]: https://img.shields.io/npm/v/posthtml-modules.svg
[npm-url]: https://npmjs.com/package/posthtml-modules

Expand Down

0 comments on commit 5a79b35

Please sign in to comment.