Grav: [BUG] js asset added inline doesn't respect order

Created on 27 Feb 2018  路  2Comments  路  Source: getgrav/grav

Hi there,

It seems that when adding a JS file inline trough param of Grav assets manager, the order is not respected. Inlined assets are always rendered on the last position.

e.g. this:

{% block javascripts %}
  {% do assets.addJs('theme://js/manifest.js, {'priority':100, 'loading':'inline'}) %}
  {% do assets.addJs('theme://js/main.js', {'priority':10}) %}
{% endblock %}
{{ assets.js }}

render into:

<script src="/user/themes/mytheme/js/main.js" type="text/javascript" defer=""></script>
<script>inlined content of manifest.js file</script>

It's a problem that js rendering order doesn't respect the given order in Grav assets manager params as it can break the js code.

Cheers

enhancement

Most helpful comment

As discussed in slack, this is really a significant change, and i've marked it as an enhancement because it will require a fair bit of work that has backwards compatibility implications. I'll look at it when i get a chance.

All 2 comments

As discussed in slack, this is really a significant change, and i've marked it as an enhancement because it will require a fair bit of work that has backwards compatibility implications. I'll look at it when i get a chance.

Thank you 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marktaylor46 picture marktaylor46  路  26Comments

tmos picture tmos  路  21Comments

escopecz picture escopecz  路  17Comments

mlueck88 picture mlueck88  路  18Comments

lazzich picture lazzich  路  19Comments