rikkitikkitumbo
rikkitikkitumbo

Reputation: 976

What to name a SLIM file? .slim? .html.slim?

Sorry for such a silly question, but couldn't find it on the docs:

filename.slim

filename.html.slim

This seems like a really great language to work with. I've used HAML before, so I think this will be a fairly nice transition.

Upvotes: 7

Views: 3893

Answers (4)

Tamik Soziev
Tamik Soziev

Reputation: 14798

Rails 7 with turbo/hotwire has an issue [1] with files that have just .slim, so I think it's better to stick with .html.slim

[1] - https://github.com/hotwired/turbo-rails/issues/287

Upvotes: 0

Evgeniy Agasyants
Evgeniy Agasyants

Reputation: 21

Better to use .html.slim extension.

For example, if your layout template named just with .slim it will append not only for html response, but for js response too.

In this case, every time then you make jxh-request, you must set layout false for every js format response.

Upvotes: 0

Eyeslandic
Eyeslandic

Reputation: 14890

filename.html.slim

However, in the generic sense, it is

filename.response_type.rendering_engine

e.g.

index.xml.haml
index.rss.slim

Upvotes: 15

Jonathan
Jonathan

Reputation: 11494

.html.slim would seem to be the convention used by the creator of slim. Though it seems to be a convention used across rails for view files, including .html.haml and .html.erb for example. The same convention is used for a lot of abstracted files like .css.scss and .js.coffee.

Upvotes: 0

Related Questions