Skip to content

Instantly share code, notes, and snippets.

@marvinahv
Last active August 28, 2020 23:57
Show Gist options
  • Save marvinahv/5894328 to your computer and use it in GitHub Desktop.
Save marvinahv/5894328 to your computer and use it in GitHub Desktop.
Render Slim template with variables in Ruby
h1 This #{foo} is here.
require 'slim'
foo = "bar"
template_path = "templates/file.slim"
template = Slim::Template.new(template_path).render(Object.new, :foo => foo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment