Didn’t work for me (site/plugins/twig/vendor/autoload.php present, Twig_Environment not loaded before that).
Unless I’m mistaken: this will always throw if Twig was not loaded outside of the plugin (we would need to use and, not or in the condition). And if Twig was already loaded, it will reload it anyway, which is wasteful.
Didn’t work for me (
site/plugins/twig/vendor/autoload.php
present,Twig_Environment
not loaded before that).Unless I’m mistaken: this will always throw if Twig was not loaded outside of the plugin (we would need to use
and
, notor
in the condition). And if Twig was already loaded, it will reload it anyway, which is wasteful.I did something a bit different but with the same intentions: https://github.com/fvsch/kirby-twig/commit/6c43d747b52d9c9bf0c3201f2926db2f4929d7d0#diff-93026c43a3912bff417fff6a5ec4767cL175