• Hi,
    First, thanks for such a wonderful plugin.

    So far, the plugin works fine. The real problem is that the JS files related to the plugin are loaded above the closing head tag in the web page. This is undesirable as all speed optimization techniques suggest loading JS files in footer. Can you please change it so that the JS files load in the footer, at least in your next patch or something?

    I am sure that the users of your plugin will really appreciate this move.

    Regards,
    Rob

    http://wordpress.org/plugins/crayon-syntax-highlighter/

Viewing 1 replies (of 1 total)
  • Does that already.

    Check options and especially:

    “Attempt to load Crayon’s CSS and JavaScript only when needed”

    If you pick monospace it will load a tiny CSS file:

    .crayon-font-monospace * {
        font-family: monospace !important;
    }

    is it. Copy that in to own theme file. Is in /uploads/crayon-syntax-highlighter/themes/YOURTHEMENAME folder. Generated by theme builder.

    When there is Crayon code you should see 1 CSS file in header and 1 JS in footer. If no code = zero files loaded.

    If it works or not might depend on theme, plugins and other code. Why he put in some options for loading stuff.

    Forgot. Font file is automatically enqued so remove because you copy CSS in to other file, what ever is already loaded will do. Your own Crayon theme file would be a good choice.

    // Crayon fix for tiny monospace.css
    add_action ( 'wp_enqueue_scripts', 'disable_crayon_monospace' );
    function disable_crayon_monospace() {
    	wp_deregister_style ( 'crayon-font-monospace' );
    }

    No reason to load 1 CSS file just for font. Handle for monospace is “crayon-font-monospace” – will be different depending on font choice.

    Not quite sure this will work out of the box if you enable bbPress and comment support. The front-end stuff. But for basic usage it can work.

Viewing 1 replies (of 1 total)
  • The topic ‘Load Crayon JS files only in footer’ is closed to new replies.