Categories
Svelte

Svelte Snippets

Remove protected comments from svelte build.

production && terser({ output: { comments: false } }),

Embed svelte bundle.js in html tag via php

$script = file_get_contents( 'public/build/bundle.js' );
// fixes svelte dev build '</script>' breaking the inline embed.
$script = str_replace( '</script>', '</fix>', $script );
$script = "<script>$script</script>";
echo $script;