5
4

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 5 years have passed since last update.

Slimでの改行

Posted at

動作環境

Ruby 2.2.0
Rails 4.2.0
slim-rails 3.0.1

Slimで以下のような記述を書いたとき

index.html.slim
.
  = @hoge
  = @fuga
  = @huge

こうなっちゃう(´・ω・`)

index.html
<div>
  hogefugahuge
</div>

こうなって欲しい( ・`ω・´)

index.html
<div>
  hoge
  fuga
  huge
</div>

イロイロ検討したけど、こうしかできなかった。。。

index.html.slim
.
  = @hoge << "\n"
  = @fuga << "\n"
  = @huge

htmlのソースコードなんて気にするなって言われそうだけど、
なんか方法ないのぉ...って話でした。

5
4
2

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
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?