Skip to content

Instantly share code, notes, and snippets.

@yashihei
Created April 18, 2019 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yashihei/bc40d519d5b33bed3c60ce383d928c56 to your computer and use it in GitHub Desktop.
Save yashihei/bc40d519d5b33bed3c60ce383d928c56 to your computer and use it in GitHub Desktop.
haml-rails導入

erbもっと楽に書きたい!

Gemfile以下を記載。

gem "haml-rails", "~> 2.0"

以下のコマンドでerb->hamlに変換。Rails5以降、rakeコマンドをrailsコマンドで叩けるようになった。

$ rails haml:erb2haml

変換元の.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.

サーバーの再起動を忘れずに。

$ rails s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment