Thin templates - removing spaces around a block tag

I am trying to create subtle templates in a new project (quite a long time using Haml). While the overall experience is great, I ran into a problem where spaces are always inserted around tags that commonly usedisplay: block

Let's say

ul.ampm
  li.am am
  li.pm pm

generates

<ul class="ampm">
  <li class="am">
    am
  </li>
  <li class="pm">
    pm
  </li>
</ul>

and

.ampm
  span.am am
  span.pm pm

generates

<div class="ampm">
  <span class="am">am</span></span class="pm">pm</span>
</div>

This is usually not a big problem, but we are using adaptive layouts that use tags display: inline-blockto li; obviously, the space between them violates the layout.

I know

Slim::Engine.options[:pretty] = true
Option

(and turning it on removes offensive gaps), but makes all generated sources difficult to read, and not just the part that I would like to fix.

<and >Slim seems to be doing the exact opposite of what I need - they are designed to add spaces around inline tags.

So...

  • Slim, HAML whitespace eaters? ( , )
  • , Slim ( " " ) -, , ?

.

+4
1

, HTML . options select:

select
  - my_collection.each do |item|
  <option value="#{item.id}">#{item.name}</option>

, ( option). , , .

Slim ( " " ) -, ?

"" . , Slim- . , GitHub:

, Slim . , , https://github.com/judofyr/temple, .

+2

Source: https://habr.com/ru/post/1569664/


All Articles