Skip to content

Commit 0a60be1

Browse files
committed
Add self-closing tag support
1 parent 220004e commit 0a60be1

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
## 1.0.1 - 2020-02-12
2+
### Improved
3+
- Added self-closing tag support!
4+
15
## 1.0.0 - 2020-02-12
26
- Initial release 🎉

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ modules, components, molecules). You can access the atoms in twig using the
2121
following syntax:
2222

2323
```twig
24-
{% x:my-atom %}{% endx %}
24+
{% x:my-atom %}
2525
```
2626

2727
The above will include `_atoms/my-atom` in your template. If `my-atom`
@@ -34,7 +34,7 @@ current template context is NOT passed to the atom, so any variables defined
3434
outside will have to be passed manually.
3535

3636
```twig
37-
{% x:my-atom { heading: "Hello world!" } %}{% endx %}
37+
{% x:my-atom { heading: "Hello world!" } %}
3838
```
3939

4040
In the above example, `my-atom` will be given access to the `heading` variable.
@@ -50,7 +50,7 @@ Children can also be passed to atoms:
5050
<p>This is my atom</p>
5151
<p>There are many like it, but this is mine</p>
5252
<p>{{ myVariable }}</p>
53-
{% endx %}
53+
{% endx:my-atom %}
5454
```
5555

5656
Children are rendered in the parent context, not the atoms. This means any
@@ -75,8 +75,8 @@ Atoms can be nested inside other atoms!
7575

7676
```twig
7777
{% x:my-atom %}
78-
{% x:another-atom %}{% endx %}
79-
{% endx %}
78+
{% x:another-atom %}
79+
{% endx:my-atom %}
8080
```
8181

8282
### Sub-folders
@@ -86,7 +86,7 @@ you had an atom at `_atoms/cards/news`, you could access it using the following
8686
syntax:
8787

8888
```twig
89-
{% x:cards/news %}{% endx %}
89+
{% x:cards/news %}
9090
```
9191

9292
### Dynamic Atoms
@@ -97,7 +97,11 @@ brackets:
9797
```twig
9898
{% set myVar = 'example-atom' %}
9999
100-
{% x:[myVar] %}{% endx %}
100+
{% x:[myVar] %}
101+
102+
{% x:[myVar] %}
103+
<p>hello world!</p>
104+
{% endx:[myVar] %}
101105
```
102106

103107
## Config

0 commit comments

Comments
 (0)