Skip to content

Twig template naming convention #2515

Closed
@pulzarraider

Description

@pulzarraider

Correct me if I am wrong, but Symfony2 documentation does not specify if filename of Twig template should be written in camelCase (articleDetails.html.twig) or with underscores (article_details.html.twig).

In Symfony naming conventions is note:

Use alphanumeric characters and underscores for file names;

But in Including other templates doc section is mentioned template filename in camel case: articleDetails.html.twig

In the majority of open source bundles there are underscores used in template filenames (for example Sonata, KnpPaginatorBundle,MopaBootstrapBundle, GenemuFormBundle, AdmingeneratorGeneratorBundle), but some use camelCase filenames (FOSFacebookBundle) or they mix it together (for example FOSUserBundle, FOSMessageBundle).

So what`s the recommended way? This should be clearly explained in documentation.

Also Twig coding standars should be linked somewhere in documentation: http://twig.sensiolabs.org/doc/coding_standards.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions