8000 [Twig] [TwigBundle] Describe the new behaviour of twig.cache config by okhoshi · Pull Request #20951 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Twig] [TwigBundle] Describe the new behaviour of twig.cache config #20951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[TwigBundle] Describe the new behaviour of twig.cache config
Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>
  • Loading branch information
okhoshi committed May 12, 2025
commit 8c5f22b3e69142381f9d84dfb4adafab46eb8c1e
12 changes: 11 additions & 1 deletion reference/configuration/twig.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ application harder to maintain.
cache
~~~~~

**type**: ``string`` | ``false`` **default**: ``%kernel.cache_dir%/twig``
**type**: ``string`` | ``boolean`` **default**: ``true``

Before using the Twig templates to render some contents, they are compiled into
regular PHP code. Compilation is a costly process, so the result is cached in
Expand All @@ -82,6 +82,16 @@ is not recommended; not even in the ``dev`` environment, because the
``auto_reload`` option ensures that cached templates which have changed get
compiled again.

Specify the path where the cache should be stored. If set to ``true``, the cache
defaults to ``%kernel.cache_dir%/twig``. However, if the ``auto_reload`` option is
disabled and ``%kernel.build_dir%`` is different from ``%kernel.cache_dir%``,
the cache will instead be stored in ``%kernel.build_dir%/twig``.

.. versionadded:: 7.3

Support for ``true`` value was added in Symfony 7.3, and it became the default
value for this option instead of ``%kernel.cache_dir%/twig``.

charset
~~~~~~~

Expand Down
0