Plugin Author
Erik
(@codekraft)
Ciao @soundfix, can you please try to exclude the “dark-mode.js” script from defer? is a small script but must be executed immediately 😀
Where or how do I “exclude the “dark-mode.js” script from defer”?
Plugin Author
Erik
(@codekraft)
probably it’s related to a caching plugin like LiteSpeed Cache, is something I see also applied to all the other scripts on your site.
I don’t have LiteSpeed Cache or other caching I know of.
Plugin Author
Erik
(@codekraft)
Sorry, the defer seems related to WordPress 6.4
I have to fix this issue releasing a new version of the plugin… Expect a new version soon
Ok, I’ll wait for the fix!
Meanwhile I tried to exclude defer with a filter in functions.php like this, but it didn’t work.
Plugin Author
Erik
(@codekraft)
Plugin Author
Erik
(@codekraft)
if you feel confortable with editing the code of the plugin and you want to give a try with the new enqueue code:
– Remove from block.json the viewscript (at the end)
– Add at the end of dark-mode-block.php (the main php file of this plugin)
/** Enqueue the block assets */
\add_action( 'wp_enqueue_scripts', function () {
\wp_enqueue_script( 'dark-mode-block', plugin_dir_url( __FILE__ ) . '/build/dark-mode.js', array(), '0.1.0', array( 'strategy' => null, 'in_footer' => false, ) );
}, 0 );
Otherwise, don’t worry and I will try to release a new version asap shortly
Remove this whole line?
"viewScript": "file:./build/dark-mode.js",
Plugin Author
Erik
(@codekraft)
yes, block.json
doesn’t allow any options for enqueues. The 2nd change (the edit in the php file) will enqueue that script in right way for this plugin.
Plugin Author
Erik
(@codekraft)
Since the changes were really limited I published the update immediately, Let me know if it works OK for you now!