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).
Slim contains Include
plugin that allows to include other files directly in template files at compile time:
require 'slim/include'
include partial_name
Documentations is available here: https://github.com/slim-template/slim/blob/master/doc/include.md
If you need to include the files at runtime
Slim::Template.new("#{ name }.slim").render
does the job (https://github.com/slim-template/slim#include-helper).