Fire-Dragon-DoL Fire-Dragon-DoL - 4 months ago 34
Ruby Question

Include a slim file in another slim file

I'm working on a static website (so no real server support) and I would like to include a small slim snippet in another, possibly passing a variable to it.

Is this possible? In rails is quite easy, though the

render
method, but I have no idea how to do it on slim (obviously
load
method doesn't work for slim).

Answer

Looks like it can be done in this way:

Slim::Template.new('template.slim', optional_option_hash).render(scope)

Found in slim readme: https://github.com/slim-template/slim

Comments