WordPress: Reason for removing Crayon Syntax Highlighter

Other language site
ja ja
Google Translate
  • -

    シェア
  • ---

    LINEで送る
  • -

    はてなブックマーク
    ブックマーク
  • -

    pocket
  • -

    rss
WordPress logo

I decided to remove the WordPress plugin Crayon Syntax Highlighter.

The reason is because there is an alternative means. So, you do not need to use a plugin.

In view of the performance of the site, and considering "Search Engine Optimization" it is better to have fewer plugins.

I decided to use Prism.js as an alternative.

Why did not you choose highlighter.js?

There is a JavaScript plug-in which highlights letters such as source code. It is highlighter.js. This is probably the most popular plugin most used.

I did not choose this one this time. The primary reason is that line number display is not the default function.

Every time you enhance the highlighter.js, you need to implement JavaScript for another extension.

It is possible to display the number of lines by implementing highlightjs-line-numbers.js. However, I stopped because I do not want to optimize the javaScript file (file combination, compression) work.

It optimizes with "Autoptimize" of WordPress plugin, so is not it such a thing? There may be opinion that it is. It is certainly so.

However, I am trying to display the first view of the site as quickly as possible. To that end, I am creating an environment that can optimize JavaScript, CSS optimization as much as I can.

The Autoptimize plugin is limited to those not customized. So I chose Prism.js with similar functionality.

Prism.js can choose features to implement

In Prism.js, when downloading the js file, you can select which function to use as an option. Each JavaScript and CSS file to download is organized into one.

JavaScript, CSS files should have smaller sizes. Functions that are not used have a wasteful effect on the performance of the site, so I do not want to implement it as much as possible. So I decided on Prism.js which can select the function in advance.

Do not you care about such a small thing? It does not affect it, is it? You may think.

However, I noticed something when working on improving site performance. The fact that such stacking of small works is not easily ignorable existence.

It is also an important factor to seek how to efficiently achieve the purpose. But what you can not solve is that it is important to move your hands as well.

Here is how to implement Prism.js. Please take a look.

SNS also distributes articles.
Leave a Reply

*

If you like this article, share it!