LoginSignup
1
0

More than 5 years have passed since last update.

特定のファイルだけerbからhamlに変換する

Posted at

はじめに

既にアプリケーションが稼働している状態で、影響範囲などを加味して部分的にerbからhamlに置き換えをしたい場合の手順です

gemfileにhtml2hamlを追加する

group :development do
    gem 'html2haml'
end

コマンドを実行

erbファイルを残す場合

for file in app/views/hoge/fuge.html.erb; do bundle exec html2haml -e $file ${file%erb}haml --trace; done

erbファイルを削除する場合

for file in app/views/hoge/fuge.html.erb; do bundle exec html2haml -e $file ${file%erb}haml --trace && rm $file; done

課題

  • 変換後のhamlを見るとロケットハッシュが使われていたり、best practicesでは無いシンタックスが散見されるので、手動でいい感じに修正する必要があります
1
0
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
1
0