drab v0.5.0 Drab.Live.EExEngine
This is an implementation of EEx.Engine that injects Drab.Live
behaviour.
It parses the template during compile-time and inject Drab markers into it. Because of this, template must be a proper HTML. Also, there are some rules to obey, see limitations below.
Limitations
Attributes
The attribute must be well defined, and you can’t use the expression as an attribute name.
The following is valid:
<button class="btn <%= @button_class %>">
<a href="<%= build_href(@site) %>">
But following constructs are prohibited:
<tag <%="attr='" <> @value <> "'"%>>
<tag <%=build_attr(@name, @value)%>>
The above will compile (with warnings), but it will not be correctly updated with Drab.Live.poke
.
The tag name can not be build with the expression.
<<%= @tag_name %> attr=value ...>
Nested expressions are not valid in the attribute pattern. The following is not allowed:
<tag attribute="<%= if clause do %><%= expression %><% end %>">
Do a flat expression instead:
<tag attribute="<%= if clause, do: expression %>">
Scripts
Tag name must be defined in the template as <script>
, and can’t be defined with the expression.
Nested expressions are not valid in the script pattern. The following is not allowed:
<script>
<%= if clause do %>
<%= expression %>
<% end %>>
</script>
Do a flat expression instead:
<script>
<%= if clause, do: expression %>
</script>
Textareas
As above, you can not use nested expressions inside the textarea tag.
Properties
Property must be defined inside the tag, using strict @property.path.from.node=<%= expression %>
syntax.
One property may be bound only to the one assign.