Skip to content

Commit 0149c6f

Browse files
committed
Add ECR compatible macros
1 parent a8b712f commit 0149c6f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/crustache.cr

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,13 @@ module Crustache
4444
tmpl.visit Renderer.new OPEN_TAG, CLOSE_TAG, Context.new(model), fs, io
4545
end
4646
end
47+
48+
macro embed_mustache(filename, io_name, model = nil)
49+
::Crustache.render(::Crustache.parse_file_static({{ filename }}), {{ model }}, ::Crustache::HashFileSystem.new, {{ io_name.id }})
50+
end
51+
52+
macro mustache_file(filename)
53+
def to_s(io)
54+
::embed_mustache({{ filename }}, "io", self)
55+
end
56+
end

0 commit comments

Comments
 (0)