将html.slim视图转换为html.erb-Rails,Slim,ERB [英] Convert html.slim views to html.erb - Rails, Slim, ERB
问题描述
试图将 *。html.slim 视图转换为 *。html.erb 。我研究了以下两个问题:
-
如何将html.slim转换为html.erb?-从控制台调用时,获取
未初始化的常量
p> -
如何将html.slim文件转换为html或html.erb?-解析器遇到
NoMethodError:未定义的image_tag表示nil:NilClass
遇到第一个= image_tag
时。我没有在通话中使用任何变量,图像标记指向和 svg
我认为,如果Stack Overflow的好人可以帮助我弄清 image_tag
问题,后一种解决方案将是最好的。
我的代码(按要求):
页面data-id = foo-page
.container
= image_tag'bar.svg'
我在Windows上使用gitbash,
这对我有用,
slimrb -e foo.html.slim foo.html.erb
Trying to convert *.html.slim views to *.html.erb. I've looked at these two questions:
How can I convert html.slim to html.erb? - getting
uninitialized constant
when called from the consoleHow can I convert html.slim files to html or html.erb? - parser hits a
NoMethodError: undefined method image_tag for nil:NilClass
when it comes across the first= image_tag
. I am not using any variables inside my call, the image tag points to and svg
I think the latter solution would work best, if the good people of Stack Overflow can help me figure out the image_tag
issue.
My code (as requested):
page data-id="foo-page"
.container
= image_tag 'bar.svg'
I was using gitbash on windows,
and this worked for me,
slimrb -e foo.html.slim foo.html.erb
这篇关于将html.slim视图转换为html.erb-Rails,Slim,ERB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!