Reputation: 27852
Right now I am able to do this:
@template = Liquid::Template.parse("hi {{name}}") # Parses and compiles the template
p @template.render('name' => 'tobi')
However, how can I call Liquid::Template
with a file that I have called template.liquid
that has the content:
hi {{name}}
Upvotes: 1
Views: 1929
Reputation: 48599
File.read() returns the whole file as a string, so you can write:
template = Liquid::Template.parse(
File.read("template.liquid")
)
Upvotes: 2