Reputation: 6732
I have a blog written in rails and I write the templates in slim. I was thinking it would be awesome to write my blog post content slim in my textarea box and convert it to html before I save it to the database
Is this possible and if so how can I accomplish it?
Upvotes: 3
Views: 1660
Reputation: 11388
The documentation says:
Slim uses Tilt to compile the generated code. If you want to use the Slim template directly, you can use the Tilt interface.
And provides the following examples:
Tilt.new['template.slim'].render(scope)
Slim::Template.new('template.slim', optional_option_hash).render(scope)
Slim::Template.new(optional_option_hash) { source }.render(scope)
And I am pretty sure that something like the following also works:
Slim::Template.new(template_path).render
The complete gist of the aforementioned line is to be found here.
Upvotes: 4