blob: 080e2befe579ddd2a3e79256e2148ae799bfd184 [file] [log] [blame]
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +01001``source``
2==========
3
4The ``source`` function returns the content of a template without rendering it:
5
6.. code-block:: twig
7
8 {{ source('template.html') }}
9 {{ source(some_var) }}
10
11When you set the ``ignore_missing`` flag, Twig will return an empty string if
12the template does not exist:
13
14.. code-block:: twig
15
16 {{ source('template.html', ignore_missing = true) }}
17
18The function uses the same template loaders as the ones used to include
19templates. So, if you are using the filesystem loader, the templates are looked
20for in the paths defined by it.
21
22Arguments
23---------
24
25* ``name``: The name of the template to read
26* ``ignore_missing``: Whether to ignore missing templates or not