From 2f87869e2298cf69de712aa38860fc3f12ce04a8 Mon Sep 17 00:00:00 2001 From: Timon F Date: Thu, 9 Nov 2017 14:12:25 +0100 Subject: [PATCH] Added Best Practice guideline for partials/include --- best_practices/templates.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/best_practices/templates.rst b/best_practices/templates.rst index b9047006c38..2699294fca0 100644 --- a/best_practices/templates.rst +++ b/best_practices/templates.rst @@ -53,6 +53,15 @@ scattered through lots of bundles. Use lowercased snake_case for directory and template names. +.. best-practice:: + + Use a prefixed underscore for partial templates in template names. + +You often want to reuse template code using the ``include`` function to avoid +redundant code. To determine those partials easily in the filesystem you should +prefix partials and any other template without HTML body or ``extends`` tag +with a single underscore. + Twig Extensions ---------------