Book Image

SvelteKit Up and Running

By : Dylan Hildenbrand
Book Image

SvelteKit Up and Running

By: Dylan Hildenbrand

Overview of this book

The JavaScript ecosystem has grown vast, complex, and daunting for newcomers. Fortunately, SvelteKit has emerged, simplifying the process of building JavaScript-based web applications. This book aims to demystify SvelteKit, making it as approachable as it makes web app development. With SvelteKit Up and Running you’ll be introduced to the philosophy and technologies underlying SvelteKit. First, you’ll follow a standard educational programming approach, progressing to a 'Hello World' application. Next, you’ll explore the fundamental routing techniques, data loading management, and user submission, all through real-world scenarios commonly encountered in day-to-day development, before discovering various adapters employed by SvelteKit to seamlessly integrate with diverse environments. You’ll also delve into advanced concepts like dynamic route management, error handling, and leveraging SvelteKit to optimize SEO and accessibility. By the end of this book, you’ll have mastered SvelteKit and will be well-equipped to navigate the complexities of web app development.
Table of Contents (19 chapters)
1
Part 1 – Getting Started with SvelteKit
5
Part 2 – Core Concepts
10
Part 3 – Supplemental Concepts

Configuring SvelteKit

The essential configuration for a SvelteKit project lives inside the svelte.config.js file. Understanding the various options available to you will empower you to make the most of SvelteKit. While we cannot cover all available options in such a brief section, the aim of it is to cover options that you are likely to find useful. For more configuration options, see the Further Reading section at the end of this chapter for more resources.

To get started, go ahead and open the svelte.config.js file from the skeleton project in your editor. Note that it’s quite simple at this point. Essentially, it imports the adapter function from the @sveltejs/adapter-auto package, specifies that function in the kit property of the config constant, and finally, exports the config object. We’re also given a type annotation via JSDoc. The config.kit property is where we will add various other properties to customize our configuration. It should look similar to this...