Reputation: 3019
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 console
How 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.
page data-id="foo-page"
.container
= image_tag 'bar.svg'
Upvotes: 6
Views: 6329
Reputation: 8865
The solution to avoid the unexpected code from Temple is to add: -o disable_escape=true
for a total of:
slimrb --rails -e -o disable_escape=true foo.html.slim > foo.html.erb
This will work :-)
Upvotes: 1
Reputation: 51
I was using gitbash on windows,
and this worked for me,
slimrb -e foo.html.slim foo.html.erb
Upvotes: 5
Reputation: 3019
As expected, the latter solution worked. The trick is to pass -e
flag, letting the interpreter know that you're converting to erb
. So the full command is:
slimrb -e `foo.html.slim` > foo.html.erb
to make sure that the interperter omits unnecessary calls to Temple::Utils.escape_html((...))
before variables, you can pass the --rails
flag like so:
slimrb --rails -e `foo.html.slim` > foo.html.erb
Upvotes: 8