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

[Ruby on Rails] ERB.Haml.Slimの書き方別

Last updated at Posted at 2020-01-01

お疲れ様です!Rails書籍を読んでいると

ERBよりも、HamlやSlimがテンプレートエンジンとして現場で採用されているらしい?です。

今回は、備忘録も兼ねてそれぞれの記述方法を書いていきまーす。

<html>
 <body>
  <h1><%= @title %></h1>
 </body>
</html>

↑ERB

%html
 %body
  %h1= @title

↑Haml

 html
  body
   h1= @title 

↑Slim

こう見ると、Slimが断然効率よくかけそうですね。
どのパターンでもかけるようにして行きたいです。

不備がありましたら、コメントいただけたら幸いです!
ありがとうございました!

参考書籍
現場で使える Ruby on Rails 5速習実践ガイド

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?