Best Practices
Storing reusable modules, and content
src/lib
is conventionally used to store components, utilities, images, and other reusable modules.
The $lib
alias is a shorthand to easily reference this directory in your imports, which helps keep your code clean and organized.
$lib
Alias: SvelteKit provides the $lib
alias to reference the src/lib
directory easily. Instead of using relative paths like ../../../lib
, you can simply use $lib
.
Directory Structure:
Last updated