Last active
August 28, 2020 23:57
-
-
Save marvinahv/5894328 to your computer and use it in GitHub Desktop.
Render Slim template with variables in Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h1 This #{foo} is here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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