molecularbear
molecularbear

Reputation: 131

Location for Symfony bundle templates

The directory structure for bundles specifies that views should be stored in <your-bundle>/Resources/views. But then the best practices for template locations says that, actually, I should store them in app/Resources/views. I can see the conveniences of doing the latter, but I don't understand:

  1. If I am organizing things into bundles, aren't I reducing the bundles' portability by "de-bundling" the views?
  2. The examples show that index.html.twig is easier to write than AcmeDemoBundle::index.html.twig, but what if I also have FooBundle::index.html.twig? I still need a way to specify which index.html.twig I want, right?

Upvotes: 1

Views: 168

Answers (1)

Stepashka
Stepashka

Reputation: 2698

The documentation is correct. Store reusable bundle's templates in <your-bundle>/Resources/views and your project's templates in app/Resources/views. There is no conflict.

If you decide to create a bundle make sure it can be reused (that's the main purpose of the bundle). Otherwise keep using your AppBundle. AppBundle will not have two /index.html.twig's.

Upvotes: 1

Related Questions