hozokit
hozokit copied to clipboard
Docker setup does not work out when new components are added
When a new component is added or renamed whilst running Hozokit in a Docker container it creates the following issue:
Warning: file_get_contents(/var/www/html/wp-content/themes/hozokit/templates/components/button/index.twig): failed to open stream: No such file or directory in /var/www/html/wp-content/themes/hozokit/vendor/twig/twig/src/Loader/FilesystemLoader.php on line 145
How to replicate:
- Run an instance of Hozokit in a Docker container.
- Render the home page.
- Add a new component with an
index.twig
file and some markup. e.gtemplates/components/button/index.twig
- Include the component in the
templates/index.twig
so that it tries to render in the homepage. - You should get a failed to open stream warning and the button component won't render.
Need to work this one out eventually but for now docker compose down && docker compose up -d
solves it (docker compose restart
does not do the trick in this case).
templates/components/button/index.twig
:
{% block button %}
<button>Press me!</button>
{% endblock %}
templates/components/button/style.scss
:
// Empty but it does exist
templates/index.twig
:
{% extends "base.twig" %}
{% block content %}
<h2>This is index.twig</h2>
<p>This content block is rendered inside base.twig, which allows the header and footer to be included as well.</p>
{% include "button/index.twig" %}
<h3>Posts:</h3>
<ol>
{% for post in posts %}
<li><a href="{{post.link}}">{{post.title}}</a></li>
{% endfor %}
</ol>
{% endblock %}