> For the complete documentation index, see [llms.txt](https://www.dicas-de-django.com.br/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.dicas-de-django.com.br/069-09-djhtml.md).

# Dica 09 - Aplicando djhtml

[![](/files/-MfuAP0TTmVUwSHDjaRn)](https://youtu.be/23mdIXcUp_o)

[djhtml](https://github.com/rtts/djhtml)

**Importante:** remova a `\` no meio das tags.

![](/files/5yQAAuqmpHdOp0r1qaxa)

```
pip install djhtml
pip freeze | grep djhtml >> requirements.txt
```

Antes:

```html
{\% extends "base.html" %}

{\% block content %}
  <h1 class="text-2xl font-bold">Conteúdo</h1>
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Vero tenetur repudiandae id animi, labore magni cumque tempore eum culpa esse exercitationem modi est enim sunt in maxime aut quo deleniti!</p>
  {\% if 'a' == 'a' %}
  {\% if '1' == '1' %}
  <span>A1</span>
  {\% endif %}
  {\% endif %}
{\% endblock content %}
```

```
find backend -name "*.html" | xargs djhtml -t 2 -i
```

Depois:

```html
{\% extends "base.html" %}

{\% block content %}
  <h1 class="text-2xl font-bold">Conteúdo</h1>
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Vero tenetur repudiandae id animi, labore magni cumque tempore eum culpa esse exercitationem modi est enim sunt in maxime aut quo deleniti!</p>
  {\% if 'a' == 'a' %}
    {\% if '1' == '1' %}
      <span>A1</span>
    {\% endif %}
  {\% endif %}
{\% endblock content %}
```
