{% if page.header.scripts %}
{% for script in page.header.scripts %}
{% do assets.addJs(script) %}
{% endfor %}
{% endif %}
Looking into the Assets.php module I can see that
the file path to the asset to be copied is appended with
the theme location. Something like this:
{{GRAV_ROOT}}{{THEME_LOCATION}}/js/script.js
However, when added dynamically the theme location part mysteriously disappears and the plugin look for the asset straight in at the Grav root. Like this:
{{GRAV_ROOT}}/js/script.js
And an error is thrown.
The plugins cannot find assets when they are dynamicly added and throws an error.
I have a template where assets are added to an individual page when they are present in the page yaml header. Like this:
scripts: ["theme://js/script.js"] styles: ["theme://css/styles.css"]
In the template they are added like this:
Looking into the Assets.php module I can see that the file path to the asset to be copied is appended with the theme location. Something like this:
{{GRAV_ROOT}}{{THEME_LOCATION}}/js/script.js
However, when added dynamically the theme location part mysteriously disappears and the plugin look for the asset straight in at the Grav root. Like this:
{{GRAV_ROOT}}/js/script.js
And an error is thrown.It's got me slightly baffled this one.