Solution for connection error prettify.css if you use Simple Code Highlighter

If you get the connection error for prettify.css when testing the site on (for example) Pingdom while using the Simple Code Highlighter plugin to display the code on the pages, try this solution that will save you a few seconds when loading the site.

My site lost 2.35 seconds because of this problem and it’s just for checking this file. If we take someone’s sites to load in less than a second, this is a problem.

What is for Simple Code Highlighter?

Simple Code Highlighter is the WordPress plugin serves to display program codes, console commands, or any other text that needs to be highlighted. You can often find an example for that in my articles that I’ve written below and that’s exactly the purpose of this plugin.

some text, command or just highlighted

I do not recommend installing it because it’s not up-to-date for more than a few months and it’s not clear whether the development will continue. Use this solution if you are already using this plugin as a temporary one until you find a replacement for this plugin.

Solution for connection error prettify.css

I noticed this problem when measuring the site’s performance on Pingdom. Otherwise, Pingdom is an excellent and free tool for measuring the speed of the site, showing everything that is loaded and troubleshooting. Here’s what the problem looks like:

I Google a little, but I did not find a quick solution, but on the page of this plugin I found exactly what I need. The solution is to open a file called pretty.js and delete or modify one part of the code. This file belongs to the plugin and you can find it in /wp-content/plugins/simple-code-highlighter/

After you open the edit file, find:

A.push("loader/prettify.css');

And do the following:

  • Solution 1: Clear exactly that part of the code. Save the file and the error disappears.
  • Solution 2: Change it to the following:
A.push("https://www.mysite.com/wp-content/plugins/simple-code-highlighter/js/loader/prettify.css");

Replace the mysite.com with address of your site.

I used the first solution. Soon I will change this plugin, and I see that the solution works. You are free to try another.

You can find a discussion of this problem here: Console Errors Prettify.css. And here’s the error disappeared:

If you are using a free and nice plugin with a similar purpose, please let me know. 🙂 Use the contact form or write me on Twitter @ivanblago

Аутор: Иван Благојевић

Радим као Engineering Lead у Адриахосту. Највише времена проводим на Линукс серверима.

Помажем људима да реше проблеме и да одаберу прави хостинг за свој сајт. Овде је моја радна биографија.

Пишем овде у слободно време.

Други текстови са блога: