Skip to content

Conversation

@s2b
Copy link
Contributor

@s2b s2b commented Nov 4, 2025

Historically, Fluid has always used generic file extensions for
template files, such as .html, .txt or .xml. While this
provides IDE integration out-of-the-box, it makes it hard to
distinguish files that are interpreted by Fluid and others that
are just text or html files.

This patch introduces an optional (!) new file extension for
Fluid template files that is added in addition to the generic
file extension: .fluid.html for html files, .fluid.txt for
text files, and so on. Template files are now detected in the
following order (first existing file wins):

templateRootPath: templates/
template: myTemplate
format: html

1. templates/myTemplate.fluid.html
2. templates/myTemplate.html
3. templates/myTemplate
4. templates/MyTemplate.fluid.html
5. templates/MyTemplate.html
6. templates/MyTemplate

If multiple template paths are defined, this chain is executed for
each path separately, before falling back to the next path. This
means that (in the TYPO3 context) an extension can ship .html
files and another extension can override these files with .fluid.html
files. It also works in reverse: The extension can ship .fluid.html,
which can be overwritten with .html files. In short: The order
of paths is respected, regardless of the file extension. This will
make it possible to ship TYPO3 extensions compatible with v13/v14
(= ships .html), while a sitepackage in a v14 project can already
use .fluid.html files. It also means that the core can rename all
templates to .fluid.html without breaking extensions that overwrite
core templates (e. g. email templates) with .html files.

The order of file extensions has been discussed intensively, but in
the end we decided to land on .fluid.*. Major reasons:

  • We currently already have mediocre IDE/editor support at best.
    Using .fluid as primary file extension would remove code
    highlighting completely until we can address each highlighter
    individually. This would also include things like Gerrit, GitHub
    or GitLab. Our time is not well spent to introduce a completely
    new file extension when there's an easier alternative.
  • With *.form.yaml there is already precedent in the TYPO3 cosmos.

Introducing this file extension not only helps users to
recognize Fluid templates, it also allows us to create better IDE
integrations in the future. Also, it enables us to scan a whole project
for Fluid templates, which makes cache warmup and linting tasks
config-free.

@s2b s2b added the merger-vote label Nov 4, 2025
@s2b s2b marked this pull request as draft November 4, 2025 18:43
Historically, Fluid has always used generic file extensions for
template files, such as `.html`, `.txt` or `.xml`. While this
provides IDE integration out-of-the-box, it makes it hard to
distinguish files that are interpreted by Fluid and others that
are just text or html files.

This patch introduces an optional (!) new file extension for
Fluid template files that is added _in addition_ to the generic
file extension: `.fluid.html` for html files, `.fluid.txt` for
text files, and so on. Template files are now detected in the
following order (first existing file wins):

```
templateRootPath: templates/
template: myTemplate
format: html

1. templates/myTemplate.fluid.html
2. templates/myTemplate.html
3. templates/myTemplate
4. templates/MyTemplate.fluid.html
5. templates/MyTemplate.html
6. templates/MyTemplate
```

If multiple template paths are defined, this chain is executed for
each path separately, before falling back to the next path. This
means that (in the TYPO3 context) an extension can ship `.html`
files and another extension can override these files with `.fluid.html`
files. It also works in reverse: The extension can ship `.fluid.html`,
which can be overwritten with `.html` files. In short: The order
of paths is respected, regardless of the file extension. This will
make it possible to ship TYPO3 extensions compatible with v13/v14
(= ships `.html`), while a sitepackage in a v14 project can already
use `.fluid.html` files. It also means that the core can rename all
templates to `.fluid.html` without breaking extensions that overwrite
core templates (e. g. email templates) with `.html` files.

The order of file extensions has been discussed intensively, but in
the end we decided to land on `.fluid.*`. Major reasons:

* We currently already have mediocre IDE/editor support at best.
  Using `.fluid` as primary file extension would remove code
  highlighting completely until we can address each highlighter
  individually. This would also include things like Gerrit, GitHub
  or GitLab. Our time is not well spent to introduce a completely
  new file extension when there's an easier alternative.
* With `*.form.yaml` there is already precedent in the TYPO3 cosmos.

Introducing this file extension not only helps users to
recognize Fluid templates, it also allows us to create better IDE
integrations in the future. Also, it enables us to scan a whole project
for Fluid templates, which makes cache warmup and linting tasks
config-free.
@s2b s2b force-pushed the feature/fluidFileExtension branch from 0962e46 to 7c59eee Compare November 8, 2025 11:30
@s2b s2b marked this pull request as ready for review November 8, 2025 11:31
s2b added a commit that referenced this pull request Nov 8, 2025
Previous Fluid versions already had a CLI command which could be used
to warmup the cache for template files, e. g. during deployment.
However, the previous implementation required a lot of additional
context and mixed parsing/compilation and rendering state. The
previous warmup implementation has already been deprecated with
Fluid v4 and removed from Fluid v5 and is now replaced with a
more straightforward implementation.

The new CLI command needs to be supplied with a list of paths that
should be scanned for template files as well as the location of
the template cache. By default, the command uses the newly introduced
Fluid file extension (see #1258) to identify Fluid templates.
However, optionally an alternative file extension can be supplied
as well.

```
bin/fluid warmup --paths examples/Resources/ --cacheDirectory examples/cache/

bin/fluid warmup --paths examples/Resources/ --cacheDirectory examples/cache/ --extension html
```

In addition to the cache warmup, the command collects and outputs
exceptions and deprecations that happened during parsing and
compilation of the found template files. The underlying API,
namely `TemplateFinder` for finding template files and
`TemplateValidator`, which produces a validation report for each
template, are marked as `@internal` for now.

Resolves: #1103
s2b added a commit that referenced this pull request Nov 8, 2025
Previous Fluid versions already had a CLI command which could be used
to warmup the cache for template files, e. g. during deployment.
However, the previous implementation required a lot of additional
context and mixed parsing/compilation and rendering state. The
previous warmup implementation has already been deprecated with
Fluid v4 and removed from Fluid v5 and is now replaced with a
more straightforward implementation.

The new CLI command needs to be supplied with a list of paths that
should be scanned for template files as well as the location of
the template cache. By default, the command uses the newly introduced
Fluid file extension (see #1258) to identify Fluid templates.
However, optionally an alternative file extension can be supplied
as well.

```
bin/fluid warmup --path examples/Resources/ --cacheDirectory examples/cache/

bin/fluid warmup --path examples/Resources/ --path examples/ResourceOverrides/ --cacheDirectory examples/cache/

bin/fluid warmup --path examples/Resources/ --cacheDirectory examples/cache/ --extension html
```

In addition to the cache warmup, the command collects and outputs
exceptions and deprecations that happened during parsing and
compilation of the found template files. The underlying API,
namely `TemplateFinder` for finding template files and
`TemplateValidator`, which produces a validation report for each
template, are marked as `@internal` for now.

Resolves: #1103
s2b added a commit that referenced this pull request Nov 8, 2025
Previous Fluid versions already had a CLI command which could be used
to warmup the cache for template files, e. g. during deployment.
However, the previous implementation required a lot of additional
context and mixed parsing/compilation and rendering state. The
previous warmup implementation has already been deprecated with
Fluid v4 and removed from Fluid v5 and is now replaced with a
more straightforward implementation.

The new CLI command needs to be supplied with a list of paths that
should be scanned for template files as well as the location of
the template cache. By default, the command uses the newly introduced
Fluid file extension (see #1258) to identify Fluid templates.
However, optionally an alternative file extension can be supplied
as well.

```
bin/fluid warmup --cacheDirectory examples/cache/ --path examples/Resources/

bin/fluid warmup --cacheDirectory examples/cache/ --path examples/Resources/ --path examples/ResourceOverrides/

bin/fluid warmup --cacheDirectory examples/cache/ --path examples/Resources/ --extension html
```

In addition to the cache warmup, the command collects and outputs
exceptions and deprecations that happened during parsing and
compilation of the found template files. The underlying API,
namely `TemplateFinder` for finding template files and
`TemplateValidator`, which produces a validation report for each
template, are marked as `@internal` for now.

Resolves: #1103
s2b added a commit that referenced this pull request Nov 8, 2025
As a follow-up to #1258, all example templates are now using the new
Fluid file extension. In all places where the file extension isn't
specified explicitly, the fallback mechanism allows us to just rename
the templates without any other changes. However, for
`setTemplatePathAndFilename()`, an explicit path is given, which
needs to be adjusted. Also, if the file extension is specified
explicitly when rendering a partial, this also needs to be adjusted
manually.
s2b added a commit that referenced this pull request Nov 8, 2025
As a follow-up to #1258, all example templates are now using the new
Fluid file extension. In all places where the file extension isn't
specified explicitly, the fallback mechanism allows us to just rename
the templates without any other changes. However, for
`setTemplatePathAndFilename()`, an explicit path is given, which
needs to be adjusted. Also, if the file extension is specified
explicitly when rendering a partial, this also needs to be adjusted
manually.
s2b added a commit that referenced this pull request Nov 9, 2025
As a follow-up to #1258, all example templates are now using the new
Fluid file extension. In all places where the file extension isn't
specified explicitly, the fallback mechanism allows us to just rename
the templates without any other changes. However, for
`setTemplatePathAndFilename()`, an explicit path is given, which
needs to be adjusted. Also, if the file extension is specified
explicitly when rendering a partial, this also needs to be adjusted
manually.
s2b added a commit that referenced this pull request Nov 10, 2025
Previous Fluid versions already had a CLI command which could be used
to warmup the cache for template files, e. g. during deployment.
However, the previous implementation required a lot of additional
context and mixed parsing/compilation and rendering state. The
previous warmup implementation has already been deprecated with
Fluid v4 and removed from Fluid v5 and is now replaced with a
more straightforward implementation.

The new CLI command needs to be supplied with a list of paths that
should be scanned for template files as well as the location of
the template cache. By default, the command uses the newly introduced
Fluid file extension (see #1258) to identify Fluid templates.
However, optionally an alternative file extension can be supplied
as well.

```
bin/fluid warmup --cacheDirectory examples/cache/ --path examples/Resources/

bin/fluid warmup --cacheDirectory examples/cache/ --path examples/Resources/ --path examples/ResourceOverrides/

bin/fluid warmup --cacheDirectory examples/cache/ --path examples/Resources/ --extension html
```

In addition to the cache warmup, the command collects and outputs
exceptions and deprecations that happened during parsing and
compilation of the found template files. The underlying API,
namely `TemplateFinder` for finding template files and
`TemplateValidator`, which produces a validation report for each
template, are marked as `@internal` for now.

Resolves: #1103

[TASK] Use Fluid file extensions in examples

As a follow-up to #1258, all example templates are now using the new
Fluid file extension. In all places where the file extension isn't
specified explicitly, the fallback mechanism allows us to just rename
the templates without any other changes. However, for
`setTemplatePathAndFilename()`, an explicit path is given, which
needs to be adjusted. Also, if the file extension is specified
explicitly when rendering a partial, this also needs to be adjusted
manually.
@s2b s2b merged commit 42a07b7 into main Nov 11, 2025
10 checks passed
@s2b s2b deleted the feature/fluidFileExtension branch November 11, 2025 16:52
@sbuerk
Copy link
Contributor

sbuerk commented Nov 11, 2025

Post +1 (approve).

s2b added a commit that referenced this pull request Nov 11, 2025
Previous Fluid versions already had a CLI command which could be used
to warmup the cache for template files, e. g. during deployment.
However, the previous implementation required a lot of additional
context and mixed parsing/compilation and rendering state. The
previous warmup implementation has already been deprecated with
Fluid v4 and removed from Fluid v5 and is now replaced with a
more straightforward implementation.

The new CLI command needs to be supplied with a list of paths that
should be scanned for template files as well as the location of
the template cache. By default, the command uses the newly introduced
Fluid file extension (see #1258) to identify Fluid templates.
However, optionally an alternative file extension can be supplied
as well.

```
bin/fluid warmup --cacheDirectory examples/cache/ --path examples/Resources/

bin/fluid warmup --cacheDirectory examples/cache/ --path examples/Resources/ --path examples/ResourceOverrides/

bin/fluid warmup --cacheDirectory examples/cache/ --path examples/Resources/ --extension html
```

In addition to the cache warmup, the command collects and outputs
exceptions and deprecations that happened during parsing and
compilation of the found template files. The underlying API,
namely `TemplateFinder` for finding template files and
`TemplateValidator`, which produces a validation report for each
template, are marked as `@internal` for now.

Resolves: #1103

[TASK] Use Fluid file extensions in examples

As a follow-up to #1258, all example templates are now using the new
Fluid file extension. In all places where the file extension isn't
specified explicitly, the fallback mechanism allows us to just rename
the templates without any other changes. However, for
`setTemplatePathAndFilename()`, an explicit path is given, which
needs to be adjusted. Also, if the file extension is specified
explicitly when rendering a partial, this also needs to be adjusted
manually.
s2b added a commit that referenced this pull request Nov 11, 2025
As a follow-up to #1258, all example templates are now using the new
Fluid file extension. In all places where the file extension isn't
specified explicitly, the fallback mechanism allows us to just rename
the templates without any other changes. However, for
`setTemplatePathAndFilename()`, an explicit path is given, which
needs to be adjusted. Also, if the file extension is specified
explicitly when rendering a partial, this also needs to be adjusted
manually.
s2b added a commit that referenced this pull request Nov 11, 2025
As a follow-up to #1258, all example templates are now using the new
Fluid file extension. In all places where the file extension isn't
specified explicitly, the fallback mechanism allows us to just rename
the templates without any other changes. However, for
`setTemplatePathAndFilename()`, an explicit path is given, which
needs to be adjusted. Also, if the file extension is specified
explicitly when rendering a partial, this also needs to be adjusted
manually.
s2b added a commit that referenced this pull request Nov 11, 2025
Previous Fluid versions already had a CLI command which could be used
to warmup the cache for template files, e. g. during deployment.
However, the previous implementation required a lot of additional
context and mixed parsing/compilation and rendering state. The
previous warmup implementation has already been deprecated with
Fluid v4 and removed from Fluid v5 and is now replaced with a
more straightforward implementation.

The new CLI command needs to be supplied with a list of paths that
should be scanned for template files as well as the location of
the template cache. By default, the command uses the newly introduced
Fluid file extension (see #1258) to identify Fluid templates.
However, optionally an alternative file extension can be supplied
as well.

```
bin/fluid warmup --cacheDirectory examples/cache/ --path examples/Resources/

bin/fluid warmup --cacheDirectory examples/cache/ --path examples/Resources/ --path examples/ResourceOverrides/

bin/fluid warmup --cacheDirectory examples/cache/ --path examples/Resources/ --extension html
```

In addition to the cache warmup, the command collects and outputs
exceptions and deprecations that happened during parsing and
compilation of the found template files. The underlying API,
namely `TemplateFinder` for finding template files and
`TemplateValidator`, which produces a validation report for each
template, are marked as `@internal` for now.

Resolves: #1103

[TASK] Use Fluid file extensions in examples

As a follow-up to #1258, all example templates are now using the new
Fluid file extension. In all places where the file extension isn't
specified explicitly, the fallback mechanism allows us to just rename
the templates without any other changes. However, for
`setTemplatePathAndFilename()`, an explicit path is given, which
needs to be adjusted. Also, if the file extension is specified
explicitly when rendering a partial, this also needs to be adjusted
manually.
s2b added a commit that referenced this pull request Nov 11, 2025
Previous Fluid versions already had a CLI command which could be used
to warmup the cache for template files, e. g. during deployment.
However, the previous implementation required a lot of additional
context and mixed parsing/compilation and rendering state. The
previous warmup implementation has already been deprecated with
Fluid v4 and removed from Fluid v5 and is now replaced with a
more straightforward implementation.

The new CLI command needs to be supplied with a list of paths that
should be scanned for template files as well as the location of
the template cache. By default, the command uses the newly introduced
Fluid file extension (see #1258) to identify Fluid templates.
However, optionally an alternative file extension can be supplied
as well.

```
bin/fluid warmup \
    --cacheDirectory examples/cache/ \
    --path examples/Resources/

bin/fluid warmup \
    --cacheDirectory examples/cache/ \
    --path examples/Resources/ \
    --path examples/ResourceOverrides/

bin/fluid warmup \
    --cacheDirectory examples/cache/ \
    --path examples/Resources/ \
    --extension html
```

In addition to the cache warmup, the command collects and outputs
exceptions and deprecations that happened during parsing and
compilation of the found template files. The underlying API,
namely `TemplateFinder` for finding template files and
`TemplateValidator`, which produces a validation report for each
template, are marked as `@internal` for now.

Resolves: #1103
s2b added a commit that referenced this pull request Nov 13, 2025
Previous Fluid versions already had a CLI command which could be used
to warmup the cache for template files, e. g. during deployment.
However, the previous implementation required a lot of additional
context and mixed parsing/compilation and rendering state. The
previous warmup implementation has already been deprecated with
Fluid v4 and removed from Fluid v5 and is now replaced with a
more straightforward implementation.

The new CLI command needs to be supplied with a list of paths that
should be scanned for template files as well as the location of
the template cache. By default, the command uses the newly introduced
Fluid file extension (see #1258) to identify Fluid templates.
However, optionally an alternative file extension can be supplied
as well.

```
bin/fluid warmup \
    --cacheDirectory examples/cache/ \
    --path examples/Resources/

bin/fluid warmup \
    --cacheDirectory examples/cache/ \
    --path examples/Resources/ \
    --path examples/ResourceOverrides/

bin/fluid warmup \
    --cacheDirectory examples/cache/ \
    --path examples/Resources/ \
    --extension html
```

In addition to the cache warmup, the command collects and outputs
exceptions and deprecations that happened during parsing and
compilation of the found template files. The underlying API,
namely `TemplateFinder` for finding template files and
`TemplateValidator`, which produces a validation report for each
template, are marked as `@internal` for now.

Resolves: #1103
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants