Import twig function not working anymore

{% import 'site/macros' as macros %}

and there is a partial site/macros.htm in the partials folder.

the site is running with site definition on the latest OC v3.

It used to work as I am resuming an old project.

Since then, the only I changed was to install Herd along the way to manage my php versions.
Could that be the culprit here ?

thanks

Just tested this on v4 and {% import 'site/macros' as macros %} with a partials/site/macros.htm works fine, so the feature itself hasn’t been removed or changed.

A few things to check on your end:

  1. Clear the Twig cache. A PHP version change (which Herd will have done) can leave stale compiled templates that fail silently. Run php artisan cache:clear and delete the contents of storage/cms/twig/.
  2. Check storage/logs/laravel.log for the actual error. “Not working” could be the import failing to find the partial, or the macro itself throwing on a stricter PHP version. The log will tell you which.
  3. Confirm the active theme. If you’re using site definitions, make sure the site is pointing at the theme that actually contains partials/site/macros.htm.

My guess is #1, Herd jumped you to a newer PHP and the old compiled cache is poisoned. Let us know what the log says if clearing doesn’t fix it.

thanks @daftspunk for coming back to me.

I am using OC v3.

  1. yes already tried, cleared cache. config and view but it does not fix the exception
  2. in the /logs/system.log i see the exception
[2026-05-24 11:34:07] local.ERROR: InvalidArgumentException: View [site/macros] not found. in /Users/christophevidal/Sites/oc-christophevidal/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:137
Stack trace:
#0 /Users/christophevidal/Sites/oc-christophevidal/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php(79): Illuminate\View\FileViewFinder->findInPaths('site/macros', Array)
  1. yes, the correct theme is applied to the site browsed.
    but it could be the problem, maybe twig is thinking to be in the main default site when i’m in a sub site.

yes, if I changed the .env file ACTIVE_THEME value with the “sub theme”, then it works fine again.
But that is not the solution indeed