Skip to main content

Part 4 / Environment variables / $env/dynamic/public

As with private environment variables, it's preferable to use static values if possible, but if necessary we can use dynamic values instead:

<script>
	import { env } from '$env/dynamic/public';
</script>

<main
	style:background={env.PUBLIC_THEME_BACKGROUND}
	style:color={env.PUBLIC_THEME_FOREGROUND}
>
	{env.PUBLIC_THEME_FOREGROUND} on {env.PUBLIC_THEME_BACKGROUND}
</main>
initialising