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
Each line of this field is a pattern, and a pattern is a part of the URL path. It applies to every page whose URL contains it. To cover one single page instead, specify its full action name.
Each pattern should be entered on a new line.
Examples:
checkout
cart
customer/account
catalogsearch/result
checkout_index_index
So checkout covers /checkout/, /checkout/cart/ and the other checkout pages, while checkout_index_index covers that one page only.
On the listed pages the extension loads the original JavaScript files instead of the bundled versions.
- Patterns are case-sensitive:
Checkoutdoes not match/checkout/. - A full URL is not matched. Specify
checkout, nothttps://example.com/checkout/. - Wildcards are not supported:
checkout/*matches nothing — plaincheckoutalready covers those pages. - A single
/is part of every URL, so it disables JavaScript bundles on the whole store.
The field ships with /checkout, which keeps JavaScript bundles disabled on the checkout pages out of the box.
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.