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.

Slimの書き方 メモ

Posted at

#基本的な書き方

/ hello      // コメント
/! hello     // ブラウザのhtmlに表示されるコメント
.test      // <div class="text"></div>
#test      // <div id="test"></div>
h3 hello    // <h3>hello</h3>
-        // <% %> rubyのコードを書くとき
=        // <%= %> 変数などrubyの値を出力するとき

・クラスやidが複数になるときは、div.btn.btn-primary.text-danger#test helloのように繋げて書いていく

・htmlの文字列とコントローラーから持ってきた変数などの連携は、

p
  | 氏名:#{name}

と繋げる。
pタグの時はpタグのすぐ後ろに文字列を書いていくのではなく、段を下に下げて|を最初に加えて書いていく。

0
0
1

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?