nerf / erb2slim

Converts Erb templates to Slim templates

Home Page:https://rubygems.org/gems/erb2slim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Erb2Slim

Converts erb template to slim template

Usage

First of all, you should install Erb2Slim as a gem.

gem install erb2slim

That's it!

Basically it gets an erb template string and returns the generated slim template as a string. Just use it like this:

require 'erb2slim'

slim_template_string = Erb2Slim.convert(erb_template_string)

How it works

Erb2Slim does not convert erb to slim directly. It first utilizes haml which supports converting html containing erb to haml. With this genertated haml, erb2slim now uses haml2slim to convert haml to slim.

Limitations

Currently, it only converts full html(erb) that contains doctype, html, head, and body tag correctly. In case of partial html(erb), the conversion is incorrect due to the limitation of the haml gem.

Required Gems

As mentioned above, 'haml' and 'haml2slim' are required.

About

Converts Erb templates to Slim templates

https://rubygems.org/gems/erb2slim


Languages

Language:Ruby 100.0%