How to convert slim to html?

I am new to ruby ​​gemstones and I tried to find information on how to compile slim-html. There is a team slimrb, but it does not work. How to convert thin file to html file?

+4
source share
2 answers

I assume there are no local variables. In this case, give them an option -l. For instance,

$ cat template.slim
div
  p= message
$ slimrb template.slim -l '{"message": "hello"}'
<div><p>hello</p></div>
+4
source

Shouichi's answer is what you are looking for.

However, from your comment, I understand that you also want to redirect the output to a file (.html file). The way this can be done depends on the shell used. For example, in (ba) sh you can do it like this:

slimrb template.slim -l '{"message": "hello"}' > template.html
+1
source

All Articles