Hi Alexander,
The “contain each included file in it’s own block” is only really intended for troubleshooting when you are trying to isolate a script that is causing issues during minification/merging. I would not enable this unless you need to.
Hi,
it’s true, but it makes that it can’t be troubleshooting anything because some scripts definitely won’t work, even that ones that work without “blocking”.
I suppose that all scripts with same handle, that comes from there 3 functions should be encapsulated in one block.
Hi Alexander,
Apologies, I realise that this must be frustrating. Unfortunately this is the way the functionality is designed to work (i.e to separate the various files)
Hi Vupdraft,
I’m afraid that I didn’t explain the problem clear enough:
Both wp_localize_script and wp_add_inline_script don’t add any file to be linked but DO some INJECTIONS (or add some additions) to the already added files by wp_enqueue_script, absolutelly connected to that has added by wp_enqueue_script by handle and can’t exists separately.
So, divide the entire and indivisible to the separate blocks is to definitely and deliberately make all, that included with the one handle unworkable.
I’m afraid but it should be included in the same block OR both, that injected by wp_localize_script and wp_add_inline_script should NOT be encapsulated in any {} blocks.
@forcesail I was partially able to reproduce the issue.
i.e. When using wp_localize_script it is added in a separate script tag and is not resulting in a error. However, if using wp_add_inline_script WP-Optimize adds separate try/catch block which is a bug and results in the error you mentioned. Thanks for reporting.
I’ve added this to our to do list. A fix will be available in the next release.