Conversation
supportHi, I’ve been working on improving my site’s pagespeed insights score and a warning/issue I’ve gotten is that my site has some unused javascript from the plugin. Below is the file being flagged. At 42KB it’s a sizeable amount of content being sent and impacting performance that is unnecessary if true. Is it possible to remove this unused JS? Here’s a page about it from google: https://developer.chrome.com/docs/lighthouse/performance/unused-javascript/?utm_source=lighthouse&utm_medium=lr …js/sassy-social-share-public.js?ver=3.3.76 41.7 KiB The page I need help with: [ log in to see the link]
Hi, Sure. For now, you can add the following code in the functions.php file of your active theme to unload the Javascript file. /** * Initialization */ function heateor_sss_custom_init() { add_action( 'wp_enqueue_scripts', 'heateor_dequeue_js_css' ); } add_action( 'init', 'heateor_sss_custom_init' ); /** * Dequeue the Javascript file of Sassy Social Share */ function heateor_dequeue_js_css() { wp_dequeue_script( 'heateor_sss_sharing_js' ); }
Hi, I tried this code, but it appears to have broken some of the sassy share features, for example the copy link button and the “more” share options button, so I had to remove it. (Though strangely, other share icons still worked). I guess this means there are some code elements within sassy-social-share-public.js that are -not- unused? Is it possible to strip out only these unused javascript within the .js file?
Yes, these share buttons depend on the JS file. It’s not possible to strip the unused code from the JS file. You should be ignoring this warning then.
Is it possible for the developer to modify the plugin in a way that deactivates unused code in a future update? This is the only plugin on my site, and I have many, that has unused code showing up in pagespeed insights without a way to disable those elements. And I have some really big plugins that I’m only using a few features of, so I think this is a common practice in other plugins that helps ensure optimal site performance. Thanks
We will take care of it in the upcoming updates.
Hi, Sure. For now, you can add the following code in the functions.php file of your active theme to unload the Javascript file. /** * Initialization */ function heateor_sss_custom_init() { add_action( 'wp_enqueue_scripts', 'heateor_dequeue_js_css' ); } add_action( 'init', 'heateor_sss_custom_init' ); /** * Dequeue the Javascript file of Sassy Social Share */ function heateor_dequeue_js_css() { wp_dequeue_script( 'heateor_sss_sharing_js' ); }
Hi, I tried this code, but it appears to have broken some of the sassy share features, for example the copy link button and the “more” share options button, so I had to remove it. (Though strangely, other share icons still worked). I guess this means there are some code elements within sassy-social-share-public.js that are -not- unused? Is it possible to strip out only these unused javascript within the .js file?
Yes, these share buttons depend on the JS file. It’s not possible to strip the unused code from the JS file. You should be ignoring this warning then.
Is it possible for the developer to modify the plugin in a way that deactivates unused code in a future update? This is the only plugin on my site, and I have many, that has unused code showing up in pagespeed insights without a way to disable those elements. And I have some really big plugins that I’m only using a few features of, so I think this is a common practice in other plugins that helps ensure optimal site performance. Thanks
We will take care of it in the upcoming updates.