Wp-rocket: Change "Exclude inline JS" arrays to a JSON / XML file

Created on 25 Jul 2019  ·  4Comments  ·  Source: wp-media/wp-rocket

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.

file optimization low enhancement

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:

  • Updating the exclusions doesn't require a plugin update anymore
  • The code itself is freed from those big arrays

All 4 comments

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:

  • Updating the exclusions doesn't require a plugin update anymore
  • The code itself is freed from those big arrays

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

Was this page helpful?
0 / 5 - 0 ratings