简体   繁体   English

推荐的Twig文件扩展名

[英]Recommended Twig file extension

Is there a recommended file extension for Twig templates? 是否有推荐的Twig模板文件扩展名? I've seen the following used, and would like to be consistent with the majority of other developers. 我已经看到使用了以下内容,并希望与大多数其他开发人员保持一致。

  • myTemplate.html.twig myTemplate.html.twig
  • myTemplate.twig myTemplate.twig
  • myTemplate.html myTemplate.html
  • myTemplate.tmpl myTemplate.tmpl

Normally you define the format before the .twig extension. 通常,您在.twig扩展名之前定义格式。 So when you work with Symfony2 for example you can define the output format. 因此,当您使用Symfony2时,您可以定义输出格式。

myTemplate.json.twig for example. myTemplate.json.twig为例。 So normally you should use that format. 所以通常你应该使用那种格式。 But you don't need that. 但你不需要那样做。

Here is an issue but you can see how it works 这是一个问题,但你可以看到它是如何工作的

https://github.com/symfony/symfony/issues/2920 https://github.com/symfony/symfony/issues/2920

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM