0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

erbファイルをhamlに変換する方法

Posted at

備忘録のために残します。

#####1、gemを追加

gemfile
gem "haml-rails"
ターミナル
bundle install

#####2、erbファイルをhamlに変換

ターミナル
rails haml:erb2haml
ターミナル
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.

元のerbファイルを削除するかどうかを聞かれる。
y or n で答える。

以上で完了!


hamlはタグを閉じる必要がない為、コード量の削減、簡略化ができるが、インデント管理のため、少しでもずれるとエラーが出る。
でも誰が書いても似たような構造になり、可読性が高いので積極的に使っていきたい。

0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?