• Resolved nicolaottomano

    (@nicolaottomano)


    Hi Frank,
    I have been using AO for a long time.

    With the 2.6.x version I noticed that you added the ao_version=2.6.x parameter to lazysizes.min.js file.
    While that could be good to refresh browser cache when you update the plugin, it leads in some annoyances for performance-mad people like me 🙂

    Please let me explain: I use Cloudflare workers to push pre-load resources hints into the HTTP headers. So I’m pushing lazysizes.min.js, among other resources, without the parameter. This was perfect until now, since I had 2 benefits:
    – Never change the worker code after an update of AO plugin
    – lazysizes.min.js was seen as static resource, so it was cached by Coudflare on their edge servers.

    Do you think it could be possible to remove the unwanted parameter from AO (maybe using a flag in configuratio)?

    Best regards,

    Nicola

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    🙂

    maybe try this code snippet;

    
    add_filter('autoptimize_html_after_minify','remove_aols_ver');
    function remove_aols_ver($in) {
    	return str_replace( '?ao_version=2.6.1-beta-1' , '', $in);
    }
    Thread Starter nicolaottomano

    (@nicolaottomano)

    Hi Frank,
    thanks for your code snippet.

    The issue I see in adding a code snippet like the one you proposed is that I must manually replace the version each time I update AO, which would be not much different than manually change the cloudflare worker.

    Maybe you could remove the ao_version param when the “Remove query strings” option is enabled?
    It is funny because AO have the “remove ver parameter” option but… it adds a version parameter itself! 😉

    Best regards,

    Nicola

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    right … stupid (esp. since I’m on the beta version and the snippet would simply not work). use this instead;

    
    add_filter('autoptimize_html_after_minify','remove_aols_ver');
    function remove_aols_ver($in) {
    	return preg_replace( '/\?ao_version=[^\']*/' , '', $in);
    }
    Thread Starter nicolaottomano

    (@nicolaottomano)

    My fault too, I didn’t thought to use RegExp!

    Kudos to you!

    Nicola

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    You’re welcome, feel free to leave a review of the plugin and support here! 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘lazysizes.min.js?ao_version=2.6.1’ is closed to new replies.