備忘録としてerbファイルをHamlに変換する方法をまとめました。
手順は下記の通りです。
#1.Gemfileにgem 'haml-rails'を記述
gem 'haml-rails'
#2.bundle installをする
記述後、bundle installをする
#3.拡張子がerbのファイルをhamlに変換
$ rails haml:erb2haml
コマンドを実行すると...
--------------------------------------------------------------------------------
Generating HAML for app/views/home/top.html.erb...
Generating HAML for app/views/home/about.html.erb...
Generating HAML for app/views/layouts/application.html.erb...
Generating HAML for app/views/layouts/mailer.html.erb...
Generating HAML for app/views/layouts/mailer.text.erb...
--------------------------------------------------------------------------------
HAML generated for the following files:
app/views/home/top.html.erb
app/views/home/about.html.erb
app/views/layouts/application.html.erb
app/views/layouts/mailer.html.erb
app/views/layouts/mailer.text.erb
--------------------------------------------------------------------------------
Would you like to delete the original .erb files? (This is not recommended unless you are under version control.) (y/n)
y
Deleting original .erb files.
変換完了です!