Open
Description
You can configure the templates as follows:
# config/packages/twig_component.yaml
twig_component:
anonymous_template_directory: 'components/'
defaults:
# Namespace & directory for components
App\Twig\Components\: 'components/'
which translates to: all Components in the PHP namespace App\Twig\Components\
will have their templates located in 'components/', so App\Twig\Components\MyModal
will become components/MyModal.html.twig
.
As some frameworks prefer snake_case over PascalCase, I'd like to configure the naming strategy as follows:
# config/packages/twig_component.yaml
twig_component:
anonymous_template_directory: 'components/'
defaults:
# Namespace & directory for components
App\Twig\Components\:
template_directory: 'components/'
name_prefix: ''
naming_strategy: 'snake_case'
so App\Twig\Components\MyModal
will become components/my_modal.html.twig
.