How can I effectively remove unused Javascript and CSS from my store?

Topic summary

Core Issue: Merchants seek guidance on removing unused JavaScript and CSS files to improve Shopify store page speed, particularly code remnants left by uninstalled third-party apps.

Technical Approach Outlined:

  • Identify unused JS/CSS files in the theme’s asset folder
  • Remove code for uninstalled apps from theme.liquid file
  • Use conditional statements (e.g., {% if template == 'index' %}) to load scripts only on specific pages (homepage, product, collection)
  • Check app documentation before deleting files to avoid breaking functionality

Key Warnings:

  • Requires basic coding knowledge and familiarity with Liquid templating
  • Not recommended without technical background
  • Risk of affecting other website functionality if done incorrectly

Common Performance Issues Mentioned:

  • Mobile speed scores significantly lower than desktop (30% vs 80% in one case)
  • Largest Contentful Paint (LCP) problems requiring removal of lazy loading above the fold
  • Image sizing and third-party code impact

Support Offered: Cedcommerce repeatedly offers free first-time optimization assistance through direct messaging for merchants lacking technical expertise. Multiple users requested help with specific stores, sharing URLs and email addresses for personalized support.

Summarized with AI on November 15. AI used: claude-sonnet-4-5-20250929.

Hello @3azzzeh ,

To improve your Shopify store speed on mobile devices, you need to work on the below-stated website issues:

  • LCP(Largest contentful pain) - To resolve this issue you need to remove lazy loading from above the fold section of your website.
  • Reduce unused JS and reduce the impact of 3rd party code - Remove unused JS files from your website.
  • Image elements do not have explicit width and height - Reduce the size of the image lies under this issue.

If you need any further help in fixing your website speed on mobile and desktop devices, please let us know.

Regards,

CedCommerce