4
4

More than 5 years have passed since last update.

Rails で erb -> haml への変換ポイント(どのgemの機能で変換するか)

Posted at

haml-rails で変換

Gemfile

gem 'haml-rails'

使える Rake task

$ ./bin/rake haml:erb2haml

実行すると元のerbファイルを削除するかどうか、プロンプトで聞いてくる。

-----------------------------------------------------------
Would you like to delete the original .erb files? (This is not recommended unless you are under version control.) (y/n)

置き換えちゃってOKな場合、yで。

公式リポジトリの参考箇所

蛇足

RubyMineでRake task実行したら、このプロンプト箇所でジーっと止まってた・・
回避方法がわからず、1度実行するだけのタスクなので、シェルから実行することに。

erb2haml で変換

Gemfile

gem "erb2haml", :group => :development

使える Rake task

変換したいだけ(erbとっておきたい)

$ ./bin/rake haml:convert_erbs

置き換え(erb削除してくれる)

$ ./bin/rake haml:replace_erbs

調べてみて気づいた・・

別々のgemで、同じタスクのネームスペース(?) haml が拡張されてるんだね。。
erb2haml はもういらないのかも。。。

この辺のグダグダ調べてた感をブログに。

Rails で erb -> haml への変換ポイント(どのgemの機能で変換するか) - まりぴよこのブログ

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4