Skip to content

Commit d447b12

Browse files
committed
feature #4556 Updated twig reference with optimizations and paths (jzawadzki)
This PR was merged into the 2.3 branch. Discussion ---------- Updated twig reference with optimizations and paths Added information about `optimizations` and `paths` twig configs to reference | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | >=2.3 | Fixed tickets | - Commits ------- f89eb39 Updated twig reference with optimizations and paths
2 parents 1726054 + f89eb39 commit d447b12

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

reference/configuration/twig.rst

+17-8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ TwigBundle Configuration ("twig")
4444
strict_variables: ~
4545
auto_reload: ~
4646
optimizations: ~
47+
paths:
48+
"%kernel.root_dir%/../vendor/acme/foo-bar/templates": foo_bar
4749
4850
.. code-block:: xml
4951
@@ -53,12 +55,14 @@ TwigBundle Configuration ("twig")
5355
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
5456
http://symfony.com/schema/dic/twig http://symfony.com/schema/dic/twig/twig-1.0.xsd">
5557
56-
<twig:config auto-reload="%kernel.debug%" autoescape="true" base-template-class="Twig_Template" cache="%kernel.cache_dir%/twig" charset="%kernel.charset%" debug="%kernel.debug%" strict-variables="false">
58+
<twig:config auto-reload="%kernel.debug%" autoescape="true" base-template-class="Twig_Template" cache="%kernel.cache_dir%/twig" charset="%kernel.charset%" debug="%kernel.debug%" strict-variables="false" optimizations="true">
5759
<twig:form>
5860
<twig:resource>MyBundle::form.html.twig</twig:resource>
5961
</twig:form>
6062
<twig:global key="foo" id="bar" type="service" />
6163
<twig:global key="pi">3.14</twig:global>
64+
<twig:exception-controller>AcmeFooBundle:Exception:showException</twig:exception-controller>
65+
<twig:path namespace="foo_bar">%kernel.root_dir%/../vendor/acme/foo-bar/templates</twig:path>
6266
</twig:config>
6367
</container>
6468
@@ -74,13 +78,18 @@ TwigBundle Configuration ("twig")
7478
'foo' => '@bar',
7579
'pi' => 3.14,
7680
),
77-
'auto_reload' => '%kernel.debug%',
78-
'autoescape' => true,
79-
'base_template_class' => 'Twig_Template',
80-
'cache' => '%kernel.cache_dir%/twig',
81-
'charset' => '%kernel.charset%',
82-
'debug' => '%kernel.debug%',
83-
'strict_variables' => false,
81+
'auto_reload' => '%kernel.debug%',
82+
'autoescape' => true,
83+
'base_template_class' => 'Twig_Template',
84+
'cache' => '%kernel.cache_dir%/twig',
85+
'charset' => '%kernel.charset%',
86+
'debug' => '%kernel.debug%',
87+
'strict_variables' => false,
88+
'exception_controller' => 'AcmeFooBundle:Exception:showException',
89+
'optimizations' => true,
90+
'paths' => array(
91+
'%kernel.root_dir%/../vendor/acme/foo-bar/templates' => 'foo_bar',
92+
),
8493
));
8594
8695
Configuration

0 commit comments

Comments
 (0)