Greg’s Plugins for WordPress

Plugins for WordPress

Portfolio of Plugins for Adoption!

SyntaxHighlighter Cleanup

Significantly increase performance by combining CSS and JavaScript calls and getting rid of unnecessary stuff dropped into the footer by Viper007Bond’s plugin for Alex Gorbatchev’s SyntaxHighlighter JavaScript.

What this Plugin Makes Possible

Have you ever wondered why so many authors who write about coding seem to have such awfully slow page load times? Have you ever noticed those authors using the same particular plugin to format code in their articles?

The purpose of this plugin is to enable the plugin that brings Alex Gorbatchev’s SyntaxHighlighter JavaScript to WordPress to be used without all those extra requests for CSS and JavaScript; it removes the former and replaces the latter with a single request.

A Trac ticket has been open to bring this kind of essential performance functionality to the WordPress front end (not just the admin side) and to make it accessible to plugin authors for more than 8 years:

http://core.trac.wordpress.org/ticket/3372

(Ironically, that Trac ticket was set to low priority by Viper007Bond, the author of the SyntaxHighlighter plugin.)

Although the severely negative performance impact of high numbers of extra HTTP requests is explicitly viewed as trivial by a handful of developers in that 8-year-old Trac discussion, for site owners who care about high performance page delivery and who don’t want their users to have to wait around while their browsers perform multiple round trips to fetch resources, this kind of thing is actually fairly important.

This plugin assumes the relevant CSS for supporting Alex Gorbatchev’s SyntaxHighlighter will be included in the site’s main CSS file.

Finally, note that related kinds of concatenation can also be performed by some minification plugins as well as by some kitchen sink-style caching plugins, provided you don’t mind output buffering hacks and the occasional serious hiccup when a theme or a plugin does something a little differently than the developers anticipated.

How it Works

This plugin communicates with WordPress primarily by tapping into the following:

  • init
  • wp_head
  • wp_footer

Configuration: None

No administrator time is required — just plug and play!