Skip to content

same-file-partial-include

Added in 1.0.0 · Related issues · View source

Fix is always available.

What it does

Checks for {% include %} tags that render a partial defined in the same template file.

Why is this bad?

{% include "file.html#name" %} reloads the template from disk to extract the name partial. When that partial lives in the same file, {% partial name %} renders it directly without the extra load and makes the same-file relationship explicit.

Example

{% partialdef item-list %}...{% endpartialdef %}
{% include "my_app/items_list.html#item-list" %}

Use instead:

{% partialdef item-list %}...{% endpartialdef %}
{% partial item-list %}

References