Fine-tune optimizations
In some cases, you may want to exclude specific pages from JavaScript or CSS optimization. For example, checkout, cart, or custom module pages may rely on certain scripts or styles that should not be delayed, moved, or minified.
Google PageSpeed Optimizer extension allows you to control this behavior using page patterns and URL rules.
Excluding pages from JavaScript bundles
Go to: Stores > Configuration > Mirasvit Extensions > Google PageSpeed Optimizer > JavaScript Optimization
Find the option:
Do not use JavaScript bundles on pages
Here, you can define a list of page type patterns (action names) or URL patterns where JavaScript bundles should not be used.
Each pattern should be entered on a new line.
Examples:
checkout
cart
customer/account
catalogsearch/result
This means that on these pages, the extension will load the original JavaScript files instead of using bundled versions.
Excluding files from minification
Still under JavaScript Optimization, you can find another setting:
Do not minify files
This allows you to list JavaScript file name patterns that should be excluded from minification. Each pattern should also be placed on a new line.
Examples:
checkout.js
custom-slider.js
some-module/
This is useful when a specific script causes issues after being minified or combined.
Skipping CSS optimization (optional)
If you have similar issues with CSS files on specific pages, you can also use exclusions under:
Stores > Configuration > Mirasvit Extensions > Google PageSpeed Optimizer > CSS Optimization
Add file or URL patterns for pages where CSS merging or minification should be skipped.
Tips for creating patterns
- Use action names for Magento-specific routes (e.g.,
checkout,customer/account). - Use URL fragments for direct page paths (e.g.,
/cart/,/checkout/). - Keep one pattern per line.
- Patterns are partial matches, so
/checkout/will match any checkout-related page.
If a page breaks after enabling optimization, start by adding its URL pattern to the Do not use JavaScript bundles list. Then, test again to confirm if the issue is resolved.