Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

System jQuery at bottom conflicts with Debug Panel

Solved by Alexander Kim View solution

Started by Alexander Kim 8 years ago · 2 replies · 610 views
8 years ago

Can i use something like that:

TWIG
    {% 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?

8 years ago Solution

In case if someone else needs this:

TWIG
        {# 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
4 years ago

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

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

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 53 11 hours ago
Support · by Anna, 3 days ago
2 60 13 hours ago
Support · by Justin Young, 14 hours ago
1 30 14 hours ago
Support · by Duc , 1 week ago
2 65 5 days ago
Support · by Colin Hume, 1 week ago
2 56 5 days ago