How can I obtain an option (get_option) inside a block viewScript?

So, if I want to add any custom styles or scripts in a block’s CSS or JS file, I usually add them in the PHP file associated with the block (the render property in block.json).

Add the following code to the PHP file at the end –

$beautiful_option = get_option('beautiful');
wp_add_inline_script('some-script', 'const BEAUTIFUL_OPTION=' .$beautiful_option, 'before');

Just make sure to add any appropriate checks and validations for the code.
Seems a bit hacky but has worked so far for me.

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino