Summary
When including images, CSS files, or other media types in SvelteKit applications, it is clear that we should leverage Vite to import the asset just as we would import a JS module. Doing so comes with the advantage of being simple but also allowing for optimized caches. It keeps our development experience smooth as Vite’s HMR will automatically show changes in the browser. It’s also flexible in that it allows for various media types to be imported either by URL or raw content.
Now that we know how to manage static assets, we should circle back to how we manage secrets. If you recall the previous chapter, we added a personal access token to the .env
file, which allowed us to authenticate with the GitHub API. In the next chapter, we’ll explore this further and cover the various modules that make managing secrets a breeze.