LoginSignup
1
0

More than 3 years have passed since last update.

Hamlについて

Posted at

Hamlとは

HTMLよりも簡単に書くためのビューテンプレートエンジンのことです。
「マークアップは美しくあるべき」という原則に基づいて開発されました。
Hamlを使用することで、「綺麗に」、「読みやすく」、「生産的に」ビューを作成することができます。

Hamlの導入方法

1.Gemfileに、gem 'haml-rails'を記述。
※どの環境に適用させるか考える。


gem 'haml-rails'

bundle installも忘れずに。


bundle install

3.ターミナルでrails haml:erb2haml を実行し、拡張子がerbのファイルをhamlに変換する。

$ rails haml:erb2haml

コマンド実行後、以下の文が出てくるが「y」を選択する。


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

yと入力するとデフォルトで作成されたerbファイルはHamlに変換される。

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