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 1 year has passed since last update.

【Rails】hamlの導入方法

Posted at

はじめに

hamlに慣れるとerbなんかで書いていられない!
毎回hamlを導入する際に、どうやるんだっけ?となるので記事にして残しておこうと思います。

RubyとRailsのバージョン

  • Ruby 2.7.7
  • Rails 6.0.6.1

2つのGem導入

Gemfileに下記記述

# hamlを使えるようにするgem
gem 'hamlit'
# erbからhamlに変換する為のgem
gem 'erb2haml'

bundle installする

bundle install

erb→hamlへ書き換えてもらう

下記コマンド実行

bundle exec rake haml:replace_erbs

これでhamlを書く準備は整いました!

便利なサイト置いておきます

erb→hamlに変換したい時

haml→erbに変換したい時

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?