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
Starting a line with a string followed by a space will create an html tag, as follows:
73
+
74
+
```slim
75
+
tt
76
+
Always bring a towel.
77
+
```
78
+
79
+
```html
80
+
<tt>Always bring a towel.<tt>
81
+
```
82
+
70
83
### Attributes
71
84
72
85
Attributes can be assigned in a similar fashion to regular HTML.
@@ -114,6 +127,7 @@ body#bar
114
127
<bodyid="bar"></body>
115
128
```
116
129
130
+
See [HEEx Support](#heex-support) for assigning attributes when rendering to HEEx.
117
131
118
132
### Code
119
133
@@ -277,6 +291,28 @@ the library after you have added new engines. You can do this by:
277
291
mix deps.compile slime --force
278
292
```
279
293
294
+
## HEEx Support
295
+
296
+
To output HEEx instead of HTML, see [`phoenix_slime`](https://github.com/slime-lang/phoenix_slime). This will cause slime to emit "html aware" HEEx with two differences from conventional HTML:
297
+
298
+
- Attribute values will be wrapped in curley-braces (`{}`) instead of escaped EEx (`#{}`):
299
+
300
+
- HTML Components will be prefixed with a dot. To render an HTML Component, prefix the component name with a colon (`:`). This will tell slime to render these html tags with a dot-prefix (`.`).
When using slime with Phoenix, the `phoenix_slime` package will call `precompile_heex/2` and pass the resulting valid HEEx to [`EEx`](https://hexdocs.pm/eex/EEx.html) with [`Phoenix.LiveView.HTMLEngine`](https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.HTMLEngine.html#handle_text/3) as the `engine:` option. This will produce the final html.
314
+
315
+
280
316
## Precompilation
281
317
282
318
Templates can be compiled into module functions like EEx templates, using
@@ -285,7 +321,7 @@ functions `Slime.function_from_file/5` and
0 commit comments