On this page
What this issue is
Minification removes characters a browser does not need to run code: spaces, line breaks, comments and, for JavaScript, long variable names. The file behaves the same but has fewer bytes. An unminified file is sent exactly as the developer wrote it.
Tools such as Lighthouse and PageSpeed Insights report this as "Minify CSS" and "Minify JavaScript". It is different from compression (gzip or Brotli), which shrinks files while they travel over the network. You want both.
Unminified
- Comments, indentation and line breaks are kept
- Long, readable variable names
- Several small files, each with its own overhead
Minified
- Whitespace and comments removed
- Short variable names in JavaScript
- Files combined or trimmed where safe
/* Unminified */
.button {
background-color: #ff6600;
padding: 12px 24px;
}
/* Minified */
.button{background-color:#f60;padding:12px 24px}Why it costs you leads or sales
Every extra byte has to be downloaded and parsed before the page can respond, especially on slow mobile connections. Slower pages lose some visitors before a form or checkout button appears. The effect of minification alone is usually small, which is why this issue is rated low impact.
Example: a 120 KB stylesheet might drop to about 90 KB when minified. Real savings depend on how the code was written.
How to check if your site has it
Run PageSpeed Insights or Lighthouse
Test your landing page on mobile. Look under Diagnostics for "Minify CSS" or "Minify JavaScript" and note the listed files and estimated savings.
Open the file in your browser
Visit the file URL. If you see readable, indented code with comments, it is not minified. Minified code appears as a few very long lines.
Check who owns each file
Files from your theme or plugins can be fixed by you. Files from third parties (chat widgets, ad tags) are minified or not by their provider, so you cannot change them.
Check compression separately
In Chrome DevTools, open Network and look at the Content-Encoding header. You want gzip or br on text files.
How to fix it
Use one optimisation plugin
Caching and performance plugins such as WP Rocket, LiteSpeed Cache or Autoptimize have a minify CSS and JavaScript option. Enable only one plugin that does this to avoid conflicts.
Test key pages
Turn on CSS first, then JavaScript. Check your form, menu and checkout after each change, because minifying or combining scripts can break some themes.
Exclude files that break
If something stops working, add that file to the plugin's exclusion list instead of turning minification off everywhere.
Check your theme
Current Shopify themes usually ship minified assets. Compare the live file with the theme code to see whether yours does.
Review installed apps
Apps add their own scripts. Remove apps you no longer use under Apps, and delete leftover code in theme.liquid.
Minify your own custom files
If you added custom CSS or JS to the theme, minify it with a build tool before uploading it to Assets.
Enable minification
Open Site settings, go to Publishing, and turn on Minify HTML, Minify CSS and Minify JS, then publish again.
Minify custom code
Code you paste into custom code fields is not changed for you. Minify it first.
Let Wix handle its own files
Wix serves its core files itself, so you have limited control. Focus on removing unused apps and custom code snippets.
Minify custom code
If you add code through Custom Code in settings, paste a minified version.
Rely on built-in handling
Squarespace serves its system files itself. You cannot change how they are built.
Minify what you add
Minify any code you add under Custom CSS or Code Injection before pasting it in.
Add a build step
Use your bundler (Vite, webpack, esbuild) in production mode, which minifies JS and CSS by default.
Or minify single files
Run the command-line tools shown in the snippet below, then point your HTML to the minified files.
Enable compression on the server
Turn on Brotli or gzip for text files in your web server or CDN.
npx esbuild app.js --minify --outfile=app.min.js
npx esbuild styles.css --minify --outfile=styles.min.cssHow to confirm it's fixed
- Re-run PageSpeed Insights and check that the Minify CSS and Minify JavaScript items are gone or smaller
- Open your CSS and JS URLs and confirm they are compact
- Check the Content-Encoding header shows gzip or br
- Submit your lead form and run a test checkout to make sure they still work
- Check in your browser console that there are no new JavaScript errors
How to prevent it happening again
- Keep minification on in your build or caching plugin
- Minify custom code before pasting it into a site builder
- Run a speed test after adding themes, plugins or apps
- Remove plugins and apps you no longer use
- Add a performance check to your release checklist
How FunnelGuard handles this
This issue is outside what FunnelGuard checks. FunnelGuard runs your real customer journeys on a schedule and checks steps, tracking hits and whether test leads arrive. It does not audit file sizes or minification.
The kind of tool that fits is a page speed or web performance testing tool, such as Lighthouse or PageSpeed Insights, or a build-pipeline check. Use it to find unminified files, and use FunnelGuard to confirm that your forms and checkout still work after you change scripts.
Questions people ask
What does unminified JavaScript and CSS mean?
It means the files are sent with spaces, line breaks, comments and long names left in. Browsers do not need these to run the code. Minifying removes them so the file is smaller and behaves the same.
How do I minify CSS and JavaScript in WordPress?
Install one optimisation plugin such as WP Rocket, LiteSpeed Cache or Autoptimize and enable its minify CSS and JavaScript options. Turn them on one at a time and test your forms and menus after each change.
Does minifying CSS and JS improve SEO?
It can help a little by making pages faster, and page speed is one signal among many. On its own the gain is usually small, so fix larger problems such as heavy images first.
Why does Lighthouse say Minify JavaScript when my plugin already minifies?
The flagged files may come from a third party, or from a plugin or theme the optimiser skips. Check the file URLs in the report to see who serves them. Add them to your optimiser, or accept it if they are third-party files.
Is minification the same as compression?
No. Minification rewrites the file to remove unneeded characters. Compression such as gzip or Brotli shrinks the file while it travels over the network. Use both for the smallest transfer.
Can minifying JavaScript break my website?
Yes, occasionally, especially when scripts are also combined or delayed. Forms, menus and tracking are the usual casualties. Test after each change and exclude any file that breaks instead of disabling minification altogether.
Can FunnelGuard detect unminified JS and CSS?
No. This needs a page speed or performance testing tool. FunnelGuard instead runs your forms and checkouts to check that they still work after you change scripts.
Related issues
- PRF-076Total page weight over 3 MB on a landing pageFix guide
- PRF-077Page weight jumped after a change (new unoptimised asset)Fix guide
- PRF-078More than 150 requests on one pageFix guide
- PRF-083Third-party scripts make up over half the page weightFix guide
- PRF-087Duplicate script loaded twice (same URL)Fix guide
- PRF-089Mobile visitors downloading desktop-size assetsFix guide