Commit 42a07b7
authored
[FEATURE] Introduce optional .fluid.* file extension (#1258)
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.1 parent a834143 commit 42a07b7
File tree
9 files changed
+36
-0
lines changed- src/View
- tests/Unit/View
- Fixtures/TemplateResolving
- Templates1
- Templates2
9 files changed
+36
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
544 | 545 | | |
545 | 546 | | |
546 | 547 | | |
| 548 | + | |
547 | 549 | | |
548 | 550 | | |
549 | 551 | | |
| 552 | + | |
550 | 553 | | |
551 | 554 | | |
552 | 555 | | |
553 | 556 | | |
| 557 | + | |
554 | 558 | | |
555 | 559 | | |
556 | 560 | | |
| |||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
268 | 300 | | |
269 | 301 | | |
270 | 302 | | |
| |||
0 commit comments