Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Volt won't recompile templates if the parent of the view changes

So I have a view the inherits from a layout.

I realized that whenever I change the parent, volt won't recompile the templates so refreshing the browser has no effect.

But as soon as I change the child view, everything works ok (it recompiles)

So it looks like volt is not checking the parent of the view to decide wether he needs to recompile the views.

Am I doing something wrong? Is it an expected behaviour? Maybe a bug?

Thanks for your help!



19.6k
Accepted
answer

From the docs:

By default, and for performance reasons, Volt only checks for changes in the children templates to know when to re-compile to plain PHP again, so it is recommended initialize Volt with the option ‘compileAlways’ => true. Thus, the templates are compiled always taking into account changes in the parent templates.

Try that.

My bad, I have overlooked that paragraph.

Thanks for pointing it out

From the docs:

By default, and for performance reasons, Volt only checks for changes in the children templates to know when to re-compile to plain PHP again, so it is recommended initialize Volt with the option ‘compileAlways’ => true. Thus, the templates are compiled always taking into account changes in the parent templates.

Try that.