There are a couple of large arrays related to exclude inline JS, exclude external JS file path, get_move_after_inline_scripts, CPCSS exclusions. Some of these arrays it seems that lately are growing really fast.
A possible solution would be to export those to a JSON / XML file. Also we can add some extra infos related to each exclusion (eg. plugin name) so in the future we can easily identify and group the JS, CPCSS incompatibilities with third party plugins.
exclude external JS file path - https://github.com/wp-media/wp-rocket/blob/46c21aa96d3673ca6d40b949c4743e0bf24ef1a5/inc/classes/optimization/JS/class-combine.php#L545
get_move_after_inline_scripts - https://github.com/wp-media/wp-rocket/blob/46c21aa96d3673ca6d40b949c4743e0bf24ef1a5/inc/classes/optimization/JS/class-combine.php#L626
rocket_cpcss_excluded_post_types - https://github.com/wp-media/wp-rocket/blob/46c21aa96d3673ca6d40b949c4743e0bf24ef1a5/inc/classes/optimization/CSS/class-critical-css.php#L182
rocket_cpcss_excluded_taxonomies - https://github.com/wp-media/wp-rocket/blob/46c21aa96d3673ca6d40b949c4743e0bf24ef1a5/inc/classes/optimization/CSS/class-critical-css.php#L244
I was thinking about this and something even better might be to maintain those lists on our side, and make them available using an API. The returned values could be saved in a transient for a week before the next call to the API.
This is offering several advantages:
This is a brilliant idea! No more updates for minor issues like exclusions
@Tabrisrp Excellent idea! It will avoid us to wait a new version to include new exclusions.
I have a question:
What will happen if the customer's server is blocking external call? Do we have a notice about that? How will it work?
I didn't think about the detailed implementation yet. But we would have to display a notice somewhere about it yes, when the option is enabled.
I also think we have other enhancements to try before, around inline script detection/exclusion, notably #2064
Most helpful comment
I was thinking about this and something even better might be to maintain those lists on our side, and make them available using an API. The returned values could be saved in a transient for a week before the next call to the API.
This is offering several advantages: