Problem/Motivation

If you start to learn about twig you probably will always go to http://twig.sensiolabs.org/doc/templates.html

On there the syntax for a extends block is {

{% extends "foo.html"}

In Drupal though you need:

{% extends "foo.html.twig"}

This is somehow a WTF.

Proposed resolution

Allow both, or don't require .twig at all.

Remaining tasks

User interface changes

API changes

Comments

Cottser’s picture

Does Symfony (or whatever) actually map foo.html to foo.html.twig? If not I think this is a won't fix or maybe we can do an upstream PR to update the docs :)

Edit: Near the top:

A template is simply a text file. It can generate any text-based format (HTML, XML, CSV, LaTeX, etc.). It doesn't have a specific extension, .html or .xml are just fine.

The docs seem to to just use .html. I think this is fine personally.

Cottser’s picture

Title: Extends in twig requires .twig extenstion » Extends in twig requires .twig extension
dawehner’s picture

Oh I simply assumed that they do some extension mechanism internally, but I guess you are right, they just use the filename and thats it.

At least \Twig_Loader_Filesystem seems not to implement something like that.

joelpittet’s picture

Status: Active » Closed (won't fix)

No magic it's just the filename.