How to set up Atom Beautify with Twig files

Hi everyone, so I loved Atom and in particular the Atom beautify package, which automatically cleans up indentation and spacing in your markup.

The problem is I can't get it to work the way I want with Twig, although they added support for it as per this thread. https://github.com/Glavin001/atom-beautify/issues/309

I commented on this thread, but I thought some of you might have found some settings that work well for the branch.

This works to make the html html around twig pretty good, but for example when you do it on something like this

<ul id="navigation">
{% for item in navigation %}
<li><a href="{{ item.href }}">{{ item.caption }}</a></li>
{% endfor %}
</ul>

      

outputs it

<ul id="navigation">
  {% for item in navigation %}
  <li><a href="{{ item.href }}">{{ item.caption }}</a></li>
  {% endfor %}
</ul>

      

when i hope that

<ul id="navigation">
  {% for item in navigation %}
    <li><a href="{{ item.href }}">{{ item.caption }}</a></li>
  {% endfor %}
</ul>

      

That I could live with a bigger problem when you have blogs with just tweak code like this

{% if entry.description %}
  {% set description = entry.description %}
{% else %}
  {% set description = entry.body %}
{% endif %}

      

it puts it all on one line like this

{% if entry.description %}{% set description = entry.description %}{% else %}{% set description = entry.body %}{% endif %}

      

I'm sure some tweaks will fix this, but I'm having a hard time finding what it might be. Anyone else lucky they set them up correctly?

its worth noting that its using Pretty Diff ( http://prettydiff.com ) to clean up and it looks like it does the same with the twig code

+3


source to share





All Articles