For those of you who use the Autoptimize and Async JavaScript combination

Get the latest from
Sniffle Valve

Sniffle Valve

Consider buying Sniffle Valve a coffee  

Book a one-on-one online training session

Note: To copy any code presented in these tutorials, hover over the code and select the Toggle RAW Code icon raw code icon

I hope that this will help some of you avoid what I recently went through. I spent the entire Canada Day 150 long weekend trying to track down what was going on with my site!

The setup:
I have the above mentioned products installed on the site.

The issue:
I also have Pastacode installed to nicely display the code snippets I provide, including my *must have option* – display line numbers.

When the above-mentioned two were setup with the recommended settings, the following was happening:
– I could not get the line numbers to display
– the mobile menu (GP + GPP) was hit and miss; mostly miss

I tried every conceivable combination (or so I thought) of settings to see if I could get them to all play together nicely. Nope. It was one or the other: line numbers and flakey mobile menu, or awesome mobile menu and no line numbers.

Finally in frustration, I did the unthinkable … I read the instructions! LOL

Turns out it was ONE checkbox in Async that I had completely not paid attention to as it was a default setting. And that was the fix: Un-check the “Enable Autoptimize Support”!  Presto! I have my line numbers, my mobile menu works like a charm, and, no console errors!  Happy camper

Here are the settings that work for me:

Leave a Comment

Your email address will not be published. Required fields are marked *