Skip to content

Commit f826622

Browse files
committed
wip
1 parent 7ab0579 commit f826622

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/1-essentials/02-views.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,23 @@ Tempest views are always compiled to plain PHP code before being rendered. Durin
622622

623623
During deployments, that cache must be cleared in order to not serve outdated views to users. You may do that by running `tempest view:clear` on every deploy.
624624

625+
## Separate view directories
626+
627+
View files can live in any directory that is discoverable by Tempest. That means: a directory with a PSR-4 namespace associated with it. If you want your view files to live outside of `src` or `app`, you can add a namespace for it in composer.json:
628+
629+
```json composer.json
630+
"autoload": {
631+
"psr-4": {
632+
"App\\": "src/",
633+
"Views\\": "views/"
634+
},
635+
}
636+
```
637+
638+
Don't forget to run `composer up` after making changes to your composer.json file.
639+
640+
Note that view files themselves don't need a namespace; this namespace is only here to tell Tempest that `views/` is a directory it should scan. If you want to add a class in the `Views` namespace (like, for example, a [custom view object](/2.x/essentials/views#using-dedicated-view-objects)), then that is possible as well.
641+
625642
## Using other engines
626643

627644
While Tempest View is simple to use, it currently lacks tooling support from editors and IDEs. You may also simply prefer other templating engines. For these reasons, you may use any other engine of your choice.

0 commit comments

Comments
 (0)