System jQuery at bottom conflicts with Debug Panel

Can i use something like that:

    {% block javascripts %}
        {# condition if debugbar plugin is on, put jquery in a head section, otherwise - bottom #}
        {% do assets.addJs('jquery', { 'priority':'101' }) %}
    {% endblock %}
    {{ assets.js() }}

Can i use some kind of conditions to put system jQuery at top or bottom depending on Debugbar plugin status on/off?

In case if someone else needs this:

        {# if debugger is enabled, load jquery to head, if not - to bottom #}
        {% if system.debugger.enabled %}
            {% do assets.addJs('jquery', { 'priority':'101' }) %}
        {% else %}
            {% do assets.addJs('jquery', { 'priority':'101', 'group':'bottom' }) %}
        {% endif %}
1 Like

use pipeline option can be necessary for some themes (like QUARK)

{% do assets.addJs('jquery', {'priority': 101, 'pipeline':false, group:'bottom'}) %}
1 Like