Project

erb2slim

0.01
No commit activity in last 3 years
No release in over 3 years
Converts Erb templates to Slim templates
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

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.