"Twig_Error_Loader: Template "file.html.twig" is not defined" for new twig template file


Cache is a pretty broad concept, and sometimes mean content caching and sometimes they mean broader things like config settings and the theme registry. Disabling content caching is still a bit confusing to me so I can't help with that part of the question.

But the theme registry has some pretty simple rules. If you add new template file (or change it's name or move it to a different folder) or if you add a new theme callback (in hook_theme) or override to a theme callback (hook_preprocess...) then you MUST clear the theme registry before they will be active. To do that, the simplest method (without additional modules or drush) is to 'Clear all caches' under admin->config->development->performance.

Of note, sometimes the theme registry is referred to as the theme cache. While I know it's probably possible, I don't think that disabling the theme registry from caching is a standard practice in development.

Tags: Theming / Drupal 8 / Drush

Similar questions

Use page.html.twig template variable in another twig template
How do I call a page.html.twig template variable from the book-tree.html.twig template. Using kint, I have found the variable, nid as in the screenshot below: The 'nid' is highlighted, but it is the 'x-default value that is required. This variable will be used in a set statement, comparing it to the item.original_link.nid to set an active class. Th...
How do I show the current node title in page.html.twig OR in node.html.twig?
If I want to show the current node title in page.html.twig (by default it seems to only be available in node.html.twig) I have to create a preprocess function like so: And then I have to overwrite page-title.html.twig by copying it into my current theme folder and commenting out everything. This doesn't seem "right". Is there a better way?
Render node content in page.html.twig level or blocks at node.html.twig level
In a Drupal 8 site design there is expected a view block and a static block in the middle of node content. I've been trying to figure out how to render node content around the block region (in page.html.twig level), render the block region in the middle of the node content (in node.html.twig level) or any other work around, for ages. I imagine one ...
adding twig variable in html.html.twig from module
I'm looking to add a twig variable, which is set in a module, and render it in the html.html.twig template file for my theme. In my module file I use the hook_preprocess_html() function where I render and set the twig variable like so: Then in the html.html.twig template file in my themes folder I simply render the new cta_bar variable like so: Thi...
Understanding page-title.html.twig and/vs field--node--title.html.twig
This question is based on the desire to have only one wrapping tag around the title value. (I am utilizing the block system to render the page/node title) Both of the templates utilize some sort of attribute array on the wrapping element, so I am not sure it is safe to remove either. I am hoping to better understand why there are two levels to this...
Override item-list.html.twig & time.html.twig inside a view
I've created a view that outputs a <ul> with a <time> element in each <li>. I need to convert the HTML list to a select. So I did 2 things: Although this works I need those 2 templates to be scoped to my view named: 'vcon-selection-table'. I tried many things but nothing works: So the question is: What template name should I use t...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.