Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

System jQuery at bottom conflicts with Debug Panel

Solved by Alexander Kim View solution

Started by Alexander Kim 9 years ago · 2 replies · 973 views
9 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?

9 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
5 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 TomW, 2 weeks ago
8 225 8 hours ago
Support · by alex, 2 months ago
8 666 23 hours ago
Support · by Supple, 5 days ago
1 97 1 day ago
Support · by TomW, 1 week ago
3 158 3 days ago
Support · by TomW, 6 days ago
2 105 5 days ago