How to force regeneration of Twig templates? Twig generates classes for its templates. These classes are effectively caches by being written to disc.

Generally speaking, one probably doesn't need to bother with the details of how the twig templates are handled, but there could be cases when the Twig templates must be manually re-generated. (Similar to the need for the Registry rebuild module in D7)

If it's relevant, I'm asking because I'm stuck with an error that looks like this:


  Fatal error: Class '__TwigTemplate_ddad913164239ac659c2bca09b3a49a5' not found in core/lib/Drupal/Core/Template/TwigEnvironment.php on line 107
Not sure why you get that specific error, but have a look at drupal_flush_all_caches(), which does

PhpStorageFactory::get('twig')-&gt;deleteAll();


That said, I'm not sure if this will solve your problem, as I've never seen that error, not sure how it could end up expecting a class that is not there.