TL;DR
Excluded Resources lets you tell NitroPack exactly which scripts, stylesheets, or assets to leave untouched during optimization. Perfect for preventing conflicts, preserving third-party functionality, or debugging with ease.
Website optimization isn’t one-size-fits-all. Some files—especially critical scripts, A/B testing libraries, or custom integrations—just shouldn’t be touched.
That’s where Excluded Resources comes in.
This feature gives you precise control over which CSS, JS, images, and fonts need to be skipped during optimization. Whether you want to avoid interfering with a delicate third-party script, preserve tracking accuracy, or troubleshoot a stubborn layout issue, this tool puts you in charge of a faster WordPress site.
What are Excluded Resources?
In web performance optimization, tools often compress, defer, or reorder JavaScript and CSS to speed up websites. But not all resources should be touched.
Some files are critical for functionality or need to load in a very specific way—especially third-party scripts like payment gateways, chat widgets, or analytics. Optimizing these can lead to broken layouts, malfunctioning buttons, or even failed API calls.
Excluded Resources let developers mark certain scripts or stylesheets to be skipped during optimization—ensuring they’re delivered exactly as written.
Test NitroPack yourself
With vs Without Excluded Resources (Example)
Imagine you’re using a payment provider’s JavaScript that must remain untouched to ensure security and compatibility. With Excluded Resources, you can prevent NitroPack from optimizing or delaying that script—avoiding conflicts without compromising overall performance.
| Scenario | Without Excluded Resources | With Excluded Resources |
| Optimizing a third-party widget | May break due to minification | Left untouched and fully functional |
| Custom admin script | May load incorrectly | Excluded to preserve original logic |
| Sensitive JS from API provider | Could trigger compatibility issues | Safely skipped by NitroPack |
Excluded Resources are a great optimization technique for:
- eCommerce: Exclude third-party checkout scripts to avoid transaction errors.
- Marketing Sites: Keep analytics and tag manager scripts untouched for clean tracking.
- Multilingual Sites: Avoid breaking translation tools by excluding their JS.
Why Are Excluded Resources Important?
Here’s why selective exclusion can make a big difference:
- Maintain Load Order: Certain elements, like animations or forms, may depend on strict timing.
- Avoid Third-party Conflicts – Some scripts don’t play well with optimization. Excluding them prevents unwanted behavior.
- Preserve Functionality – Mission-critical resources remain stable and unmodified.
- Reduce Debug Time – Know exactly what’s being excluded to isolate performance issues more quickly.
- Enable Gradual Optimization – Great for debugging or rolling out changes in stages.
Additionally, using excluded resources strategically can help reduce or fix several Google PageSpeed Insights warnings:
- Eliminate render-blocking resources: Prevents critical CSS from being deferred when it shouldn’t be
- Ensure text remains visible during webfont load: Stops optimization of font-loading scripts that need custom handling
- Reduce unused JavaScript: Helps isolate scripts that are necessary but shouldn’t be bundled
- Avoid chaining critical requests: Preserves the original load order of essential resources
By excluding the right resources, you maintain stability while improving metrics like First Contentful Paint (FCP) and Time to Interactive (TTI).
Excluded Resources by NitroPack Explained
When you use this feature, NitroPack checks the URLs of CSS and JavaScript files. If a match is found based on your exclusion rules, NitroPack leaves the file out of the optimization process.
You can exclude resources based on:
- File name or partial URL
- File type (JS, CSS, image, font)
- Resource relations (inline or external)
- Device type (mobile, desktop, or tablet)
This is particularly useful for:
- Custom scripts that should not be minified or deferred
- Critical tracking or analytics tools
- Third-party scripts that rely on specific load behavior
NitroPack vs No Resource Exclusion
| Feature | No Exclusion | With Excluded Resources |
| Optimizes every file | ✅ Yes | ❌ Excludes specific files |
| Risk of script breakage | ✅ Higher | ❌ Reduced |
| Control for developers | ❌ Limited | ✅ High |
| Best for fragile integrations | ❌ Risky | ✅ Safe and stable |
How to Use Excluded Resources by NitroPack
To use this feature:
- Go to your NitroPack dashboard
- Navigate to Cache Settings >> Cache
- Enable “Excluded Resources”
- Enter the URL/code of the file(s) you want to exclude
- Choose the different filters from the drop down menus
- Save to apply changes
After configuration, NitroPack will skip those resources during all future optimizations.
💡 Important tips
— Exclude with Purpose: Don’t exclude everything—it reduces optimization benefits.
— Avoid Duplicates: Exclude only once per file, even if it’s used across pages.
— Test on Staging First: Always validate exclusions in a safe environment before going live.
For more advanced setup tips, visit our Excluded Resources guide.
Leverage 50+ automated optimizations and
control script behavior with NitroPack →
FAQs
Can I exclude inline scripts or styles?
Yes, you can. After entering the file’s URL/code, from the Resource Relation drop-down menu, choose “Inline.”
What if I exclude the wrong resource?
You can remove it from the exclusion list anytime from the dashboard.
Does excluding resources hurt performance?
It depends. If the excluded file is large or render-blocking, it might impact performance. Use this feature strategically.
How can I identify what to exclude?
Start with any file that breaks functionality when optimized or deferred. Testing tools and browser dev tools can help.