2017-03-16 58 views
0

我想在Ruby中这样做,而不是从shell或通过加载器系统。从字符串编译slim到html?

喜欢的东西如何在ERB你可以做ERB.new("<%= 'hello' %>").result(binding) == "hello"

slim_string = "a href='#' home" 
html = # ???? 

回答

2

你可以这样做:

Slim::Template.new { "a href='#' home" }.render