This is an issue that is caused by minification from a third-party plugin. However, this issue can be fixed on the Cornerstone / Pro end, so I’m hoping you can help!
The JS snippet that gets generated and inserted into the front-end for importing Adobe Typekit fonts does not have semicolons at the end of lines, and when this gets minified by the HTML minification available within Siteground Optimizer, this causes an error, which means that no custom Adobe fonts get imported.
I am aware that in other cases, minification is not required as the CSS / JS files bundled within Pro / Cornerstone are already minified, however minification of the HTML is sometimes a required step as the generated HTML is not necessarily optimised. When this happens, however, it is attempting to minify the Adobe Typekit JS snippet, which removes line breaks, and consequently causes an error as semicolons are not present to indicate end of lines.
The snippet is located in pro/cornerstone/includes/classes/styling/class-font-manager.php
from line 412
As an example, a few of the lines are as follows:
var tk = doc.createElement("script")
var loaded = false
var firstScript = doc.getElementsByTagName("script")[0]
The error that shows up in the Chrome Console is Uncaught SyntaxError: Unexpected token 'var'
and this is the line that is causing the error in the HTML
I was able to work around the error by adding ;
to all the line endings.
There may be a more efficient way of sorting this out, but this is what I was able to do to fix the problem with the JS snippet.