Every WordPress site accumulates weight. A plugin enqueues its stylesheet everywhere because that’s easier than checking. A theme ships seven font weights because the demo used them. A page builder leaves the old layout’s assets behind. None of it is visible from the outside, which is why it survives for years.
A static build makes the bill visible. The goal isn’t the smallest folder. It’s the smallest download per page without breaking anything. Those are different targets, and chasing the first costs time you could spend on the second.
Start with the report, then go to the list
Build the site and read What’s in your static site. Start with the unused check: it names files nothing refers to, with a total size. Fix those if they’re real. Then look at size by type and the heaviest pages. Unused files are usually a small share; assets on every page are the bigger, quieter cost.
Preview files is where the audit happens. Sort by size, filter by type and use the “used on” count as your guide. A file used on every page is a decision you made once and never revisited. A file used on one page is probably fine.
Unused CSS and JavaScript
StaticScope treats a file as unused when no page, stylesheet or script refers to it. Pages, sitemaps, robots.txt, the favicon, .nojekyll and anything listed under Extra files to include are exempt. That’s a sensible definition, and it still produces false positives. A script that builds a URL at runtime, or content loaded by AJAX, can need a file no static scan can see.
You have two ways to remove a file. Leave these files out on the report excludes it from the build. Dequeuing it in WordPress stops it being loaded at all. Dequeue it. Build exclusion is a bandage that only applies to this copy, and it hides a dependency you’ll trip over later. If the file is no longer used, remove the code that enqueues it.
If a file only exists for another plugin’s edge case and you can’t dequeue it safely, exclude it at build and write down why. Don’t build a long exclusion list and call it an audit.
A stylesheet can be used and still be mostly dead. The count says “loaded on 40 pages”, not “38 KB of rules match nothing”. That needs a coverage run in DevTools. Start with the low-risk removals.
Plugin assets loaded on every page
Filter stylesheets or scripts and look for the ones with the highest used-on count. A contact form plugin that adds 60 KB of CSS to all 200 pages is a common find. So is a gallery plugin on a site with one gallery, or a page builder’s front-end bundle on pages built without it.
The built HTML gives you the handle. WordPress builds the ID from it: contact-form-7-css for a stylesheet, contact-form-7-js for a script. Search the page for the file name, read the ID, and you have the handle to dequeue.
add_action( 'wp_enqueue_scripts', function () {
if ( ! is_page( 'contact' ) ) {
wp_dequeue_style( 'contact-form-7' );
wp_dequeue_script( 'contact-form-7' );
}
}, 100 );
Put that in a small site plugin or your child theme, not in the parent theme where an update will erase it. The priority of 100 runs after most plugins have enqueued. Rebuild and check the pages that still need the form.
Condition on the template or the block, not a list of page IDs that will rot. The trade-off is maintenance: a new page that needs the plugin has to match. Cheaper than shipping the asset everywhere.
Duplicate libraries
Two copies of jQuery are the classic. Two sliders, two lightboxes, a date picker in the theme and another in a form plugin are close behind. They are straightforward to identify once you sort scripts by size: similar names, similar byte counts, different folders.
Find out which plugin owns which copy, then dequeue the older one. Test the interactions that depend on it, as well as the page load. A plugin may ship its own fork with a patch it needs. Removing the wrong copy can break one form and nothing else, exactly what a preview click-through misses.
A theme loading Bootstrap and a plugin loading its own grid is several hundred kilobytes of overlapping rules. Removing one is a code change, not a build setting. Budget the time or leave it alone.
Large images
Images are usually the largest share of page weight and the simplest thing to fix. Filter images, sort by size and open the top few. The detail tells you which pages use each one. A 3 MB photo on the home page is a different problem from a 3 MB photo on a page nobody visits.
Bytes alone don’t tell you whether an image is oversized. Check the pixel dimensions against where it appears. A 4000px camera file in a 700px column is wasting most of its pixels. On macOS, sips -g pixelWidth -g pixelHeight image.jpg gives you the numbers. ImageMagick’s identify does the same elsewhere.
Look for PNGs used as photographs, files ending in -scaled that are still enormous, and the same picture uploaded twice under different names. Replace them in the media library at a sensible size, then rebuild.
Icon fonts
An icon font is a font file carrying a handful of glyphs. Font Awesome, Elementor’s icon set and several theme fonts run from 50 KB to 300 KB, and are usually loaded on every page. If the site uses six icons, that’s a poor trade.
Filter fonts and look for names like fontawesome, icomoon or elementor-icons. Check the used-on count against how many icons appear. Three options, in increasing order of effort: keep it, subset it to the glyphs you use, or replace the icons with inline SVG. Subsetting saves the most bytes for the least markup change. Inline SVG is cleaner but means touching every icon call.
Also check formats. An old @font-face block may list WOFF and TrueType as well as WOFF2. The browser downloads one; the build copies all of them, and the estimate counts all of them. Deleting the legacy formats is a small, safe win.
Tracking scripts and other third parties
Third-party scripts aren’t in the build folder. StaticScope only copies files from your own site, so Google Analytics, a tag manager, a chat widget or a heatmap tool stays a URL in the HTML. Page size doesn’t count them either. That’s the biggest blind spot in any file-based audit.
Search the built pages for external scripts and count them per template:
grep -rho 'src="https://[^"]*"' . --include='*.html' | sort | uniq -c | sort -nr
Then ask what each one is for and who reads the data. A tag manager with fourteen tags is a performance decision, as well as a marketing one. Remove what nobody uses. For what stays, load it after the page is usable, and don’t let a consent tool become another render-blocking script.
Fonts you never use
The build can tell you a font file is referenced by a stylesheet. It can’t tell you a glyph is drawn. For that, read the CSS. Search for @font-face blocks, list the families and weights, then search for font-family and font-weight rules that use them. A family declared but never selected is dead. A 300 weight declared and never used is dead too.
Theme settings are often the culprit: a weight picker that loads every option. Fix it in the theme or child theme, remove the unused @font-face blocks and rebuild. Keep a reliable fallback stack so the page still reads before the font arrives.
A prioritised checklist
Work top to bottom. The early items are high impact and low risk; the later ones need more testing.
- Remove plugins and themes you don’t use. Deactivate and delete. This beats every micro-optimisation below.
- Replace oversized images. Resize to the largest place they appear, then compress. Biggest byte win, lowest functional risk.
- Cut unused font files and weights. Usually a theme setting or a handful of
@font-facerules. - Dequeue plugin CSS and JS where they aren’t needed. Target the highest used-on counts first.
- Remove duplicate libraries. More testing, still a clear win.
- Subset or replace icon fonts. Worth it for a small icon set, not for a large one.
- Defer non-critical scripts. Covered in render-blocking CSS and JS.
- Remove tracking nobody reads. Check with whoever owns the accounts before deleting the tag.
- Exclude dead files at build. Last resort, with a note on why.
Measure the change, not the effort
After each change, rebuild and compare the same page. StaticScope keeps the last build, not a history, so write the numbers down or keep the ZIP. If the page didn’t move, the change didn’t matter, whatever the file list says.
Don’t optimise the total folder size and call it done. A site can lose 40 MB of unused uploads and still send the same 1.4 MB page. Page size and used-on counts are the numbers that follow a visitor around.
Preview before you delete. A file can be loaded by a script that builds its path at runtime, and the file list won’t see it. Click the forms, menus, sliders, maps and search on the preview. If the badge stays green, the file was probably safe to drop.