tom
tom

Reputation: 49

How to convert slim to html?

I am new to ruby gems and I have tried to find information about how to compile slim to html. There is a slimrb command, but it did not work. How do I convert a slim file to a html file?

Upvotes: 4

Views: 4399

Answers (2)

egwspiti
egwspiti

Reputation: 987

Shouichi's answer is what you're looking for.

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

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

Upvotes: 3

Shouichi
Shouichi

Reputation: 1150

I assume local variables are missing. In that case, give them with -l option. For example,

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

Upvotes: 5

Related Questions