hozokit icon indicating copy to clipboard operation
hozokit copied to clipboard

Docker setup does not work out when new components are added

Open csalmeida opened this issue 3 years ago • 0 comments

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:

  1. Run an instance of Hozokit in a Docker container.
  2. Render the home page.
  3. Add a new component with an index.twig file and some markup. e.g templates/components/button/index.twig
  4. Include the component in the templates/index.twig so that it tries to render in the homepage.
  5. 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 %}

csalmeida avatar Dec 18 '21 17:12 csalmeida