Forum Replies Created

Viewing 15 replies - 76 through 90 (of 103 total)
  • Plugin Author codealfa

    (@codealfa)

    Yes I’m quite aware of that actually. When I say ‘having the JCH Optimize plugin run’, I’m referring to the jchoptimize function that gets called when the buffer closes. That’s where the optimization happens. So generally yes that would mean starting the caching buffer before the JCH Optimize buffer as you have rightly pointed out.

    With the current implementation though, assuming the caching occurs whenever your buffer closes, then the caching will occur before the optimize function runs even if you started your buffer first since I’m looping through and closing all the levels of buffering and concatenating them. There’s no harm done here as I explained earlier since WordPress does the exact same thing one step later anyway so me doing it shouldn’t affect anybody in anyway that WordPress hasn’t.

    I’m trying to ensure that the full HTML is available whenever I call the optimize function. Your solution doesn’t work for me as I’ve seen plugins starting buffers they’re not closing, and I’ve seen plugins closing buffers that haven’t started. I’ve also seen different parts of the HTML in different levels so I can’t rely on a callback to ensure I’m getting the HTML when my buffer closes.

    Plugin Author codealfa

    (@codealfa)

    I should also add that I am aware of the ‘incompatibility’ with caching plugins. I generally test the plugin with WP Super Cache so I regrettably noted that with the last change the caching plugin no longer cached the optimized HTML, something I would prefer to have happen myself. The ‘consolation’ though was that JCH Optimize comes with its own level of caching.

    I’ve put in a lot of effort to have the plugin run as fast as possible. The results of the combining and minification functions are cached so on subsequent requests the plugin should run under 100ms.

    Anyway I’ll continue to research to see if there’s a way I can have my plugin compatible with other plugins including caching plugins.

    Plugin Author codealfa

    (@codealfa)

    Thanks for your feedback. When you say ‘compatible’ I’m assuming you mean having the JCH optimize plugin run before the caching plugin so the output of JCH optimize is cached by the plugin.

    Coming from a Joomla! background, one of the challenges I have with WordPress is that there is no native way of accessing the processed HTML. Therefore, developers who need to access some or all parts of the HTML have to resort to PHP’s buffering functions to do so. I’ve found that different developers are doing all sorts of things so compatibility between plugins that uses output buffering is a major challenge.

    The problem with your solution, which I’ve tried before, is that the plugin needs the complete HTML that is enclosed between (and including) the <html> tags in order to work. When the optimize function is called in the buffer callback, there’s no guarantee what is in the current buffer. If throughout the page requests the buffers are not properly nested, which I have encountered, the function gets called before the full HTML is ready. I’ve even seen different parts of the HTML in different levels of buffer, which is why I’m looping through all the levels.

    I’m shutting down the buffer just before WordPress does it anyhow. I do it in the shutdown hook using a priority of ‘0’ and WordPress calls this function in the shutdown hook using a ‘1’ priority in the wp-includes/functions.php file:

    function wp_ob_end_flush_all() {
    	$levels = ob_get_level();
    	for ($i=0; $i<$levels; $i++)
    		ob_end_flush();
    }

    In the absence of a native buffer API and a way for users to order which plugins should run first, I think as developers we should work together on a convention that makes our plugins work well together. I would propose my solution with two small changes. I could hook into shutdown a little earlier but restarting the buffer after running my functions so caching plugins can hook into shutdown after and cache the optimized HTML. So my codes would look like this:

    add_action('template_redirect', 'jch_buffer_start', 0);
     add_action('shutdown', 'jch_buffer_end', -1);

    and

    function jch_buffer_end()
    {
            $sHtml = '';
    
            while (ob_get_level())
            {
                    $sHtml = ob_get_clean() . $sHtml;
            }
    
            ob_start();
    
            if (JchOptimizeHelper::validateHtml($sHtml))
            {
                    echo jchoptimize($sHtml);
            }
            else
            {
                    echo $sHtml;
            }
    }

    Plugin Author codealfa

    (@codealfa)

    I don’t think you understand what I was explaining previously so let’s try again.

    The error is not caused by the plugin. It was there before but PageSpeed is now flagging the JCH file because it contains the contents of the original file. This is why I was suggesting that you do the before and after comparison with PageSpeed to see for yourself. Please deactivate the plugin and run a PageSpeed analysis then run it again with the plugin activated and see if the plugin is adding any errors. Even with the free version, if you configured it properly, you should see less errors and a higher score. If you don’t then there’s no point in using the plugin.

    The plugin doesn’t fix this error at all. What I was describing was a workaround that the pro version provides. If you’re using the Automatic settings then the Minimum – Average setting will preserve the original execution order of the files on the page so if there are any files excluded from the plugin, the plugin will split the combined file around the excluded file to ensure that the execution order is preserved. I’m assuming that’s what is happening on your site why you’ll end up with a file that small. The higher settings in the pro version will safely combine all the files in one and still preserve the execution order. That way you’ll have one combined file and it won’t be a small file. The only other error you would need to contend with is the Eliminate render-blocking and the article I mentioned describes how to address this with the plugin.

    If you still don’t understand what I’m saying then post your site’s url here with the plugin activated and I’ll run the tests for you and explain again with screenshots.

    Plugin Author codealfa

    (@codealfa)

    Ok no problem. Looking forward to it.

    Plugin Author codealfa

    (@codealfa)

    Did you run the PageSpeed analysis with the plugin off so you can compare both reports? My guess is that you would see that suggestion anyhow. It’s not really ’caused’ by the plugin, the JCH url is shown there now because the contents of the original file is now combined by the plugin.

    It’s just saying that the file is relatively small so instead of putting the CSS in a file, you could have put it in an inline style declaration instead to avoid a http request. It’s not a big deal actually. The performance gain is negligible with this change.

    I’m assuming you’re using the free version but the pro version will give you more options that would address this issue anyway. With the higher Automatic settings available, you would be able to safely combine all the files in one, further reducing http requests and you would have options to eliminate render-blocking. Take a look at this article that sheds more light on that:
    https://www.jch-optimize.net/documentation/tutorials/eliminate-render-blocking.html

    What do you call bad behavior plugin? And also note that there are many other aspects, apart from caching, to speed up your website.

    Front end performance optimization hosts a list of techniques to improve your wordpress speed. And if you are only using caching then I’m pretty sure you can get in some more.

    Do some research on website performance optimization techniques and try JCH Optimize plugin and see if this plugin doesn’t get you faster loading times.

    Plugin Author codealfa

    (@codealfa)

    Ok thanks. You can consider leaving a review for use so others will know the plugin can be useful for them.

    I would like to resolve the issue you have with 1.1.4 though so please submit a ticket with admin access and FTP to your server or test site and I will fix it for you.

    Plugin Author codealfa

    (@codealfa)

    Ok so you’re using 1.1.3 now? You can get the pro version on the website for any official version if you have a subscription. Go to Downloads -> All Official Releases -> WordPress.

    Since you have a subscription the best way for me to address this is if you submit a ticket on the website with admin access and FTP login to your server. That way I can troubleshoot and know for sure what the problem is rather than guessing.

    Try using the JCH Optimize plugin to combine your javascript and css files to reduce http request. A powerful combination with WP Super Cache to speed up your website. Be sure to flush your cache after installing and configuring the plugin:

    https://www.ads-software.com/plugins/jch-optimize/

    Plugin Author codealfa

    (@codealfa)

    Very strange. Are the javascript files still being combined?

    Try flushing all your cache if you have a caching plugin installed. Try deactivating and reactivating the JCH Optimize plugin, clean the plugin cache and re-configure the plugin.

    Plugin Author codealfa

    (@codealfa)

    I’ve added a tutorial to the site to explains how to do this in detail:

    https://www.jch-optimize.net/documentation/tutorials/eliminate-render-blocking.html

    Plugin Author codealfa

    (@codealfa)

    Thanks for your commendations and your support. You should consider writing a review for us :).

    The lazy load image function is not supposed to work like that so I imagine there may be a slight conflict with something somewhere. Images above the fold should show right away so maybe you want to exclude these images. You can easily exclude them now by file path but in a future version there’ll be more options such as excluding by class.

    Did I understand your issue correctly? I’m not sure I understand what you mean by “It would be nice to have the option to put a value for lazy loading, put in pixels, that the end-user can change.”

    Plugin Author codealfa

    (@codealfa)

    You’ll need the pro version of the plugin to do that. The Premium and Optimum settings places the JCH Optimize combined javascript file at the bottom of the page and the Optimum setting adds the defer and async attributes to further prevent javascript render-blocking.

    The ‘Optimize CSS Delivery’ setting in Pro Options prevents CSS render-blocking. This setting attempts to extract the critical CSS required to display the section of the page above the fold from the combined file. The rest of the file is then loaded via javascript after the page is rendered.

    Plugin Author codealfa

    (@codealfa)

    Ok at this point I’m just guessing around. The best way for me to assist is for you to submit a ticket on the site with admin access and FTP login so I can troubleshoot it on your site or test server. You’ll need a subscription to submit a ticket.

    https://www.jch-optimize.net/

Viewing 15 replies - 76 through 90 (of 103 total)