LoginSignup
0
1

More than 3 years have passed since last update.

【Rails】Hamlの導入

Last updated at Posted at 2020-05-20

Hamlとは

Hamlとは、HTMLよりも簡単に書くためのビューテンプレートエンジンです。
今回の記事では、hamlの導入方法についてまとめてみました。

Hamlの導入手順

1. Gemfileへ記載

Gemfile
# 省略
gem 'haml-rails'

2. ターミナルで bundle install を実行

ターミナル
$ bundle install

新規作成されるファイル

  • app/views/layouts/application.html.haml
  • app/views/layouts/mailer.html.erb
  • app/views/layouts/mailer.text.erb

3. ターミナルで rails haml:erb2haml を実行

ターミナル
$ rails haml:erb2haml

上記のコマンドを実行すると、自動的に拡張子をhamlに変換してくれます。
これで、hamlの導入は完了です。

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