Learn how to leverage the officially supported Svelte framework to build faster and more powerful web applications by following along with real-world scenarios.
Key Features
Develop JavaScript applications with an intuitive and beginner-friendly framework
Grasp the core concepts of SvelteKit effortlessly with real-world examples
Discover how SvelteKit minimizes obstacles in building modern web applications, enhancing productivity and efficiency
Book Description
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.
What you will learn
Gain a comprehensive understanding of the core technologies of SvelteKit
Dive deep into SvelteKit's file-based routing system and uncover basic and advanced concepts
Master code organization in SvelteKit through effective data-loading techniques
Elevate your application's visibility by incorporating SEO and accessibility
Streamline the deployment process of your SvelteKit apps by using adapters
Optimize your SvelteKit app by exploring various configuration and tooling options
Who this book is for
This book is for web developers aiming to enhance their SvelteKit skills. Whether you're selecting your first JavaScript framework or seeking to stand out among job applicants by adding the latest technology to your resume, this book is your ultimate guide to becoming a SvelteKit master. A solid understanding of HTML, CSS, JavaScript, and Svelte is a must.
Author(s): Dylan Hildenbrand
Publisher: Packt Publishing Pvt Ltd
Year: 2023
Language: English
Pages: 199
SvelteKit Up and Running
Contributors
About the author
About the reviewer
Preface
What is SvelteKit?
How does Vite simplify development?
Dependencies
Source code
Who is this book for?
What does this book cover?
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Share Your Thoughts
Download a free PDF copy of this book
Part 1 – Getting Started with SvelteKit
1
Initial Setup and Project Structure
Technical requirements
Prerequisites
Installing SvelteKit
SvelteKit’s Project Structure
static/
tests/
src/
Hello World Application
Summary
Resources
2
Configurations and Options
Technical requirements
Configuring SvelteKit
alias
appDir
csp
csrf
env
prerender
Configuring Vite
plugins
server
build
preview
optimizeDeps
ssr
Summary
Further Reading
3
Compatibility with Existing Standards
Technical requirements
Fetch
FormData
URL
Summary
Resources
Part 2 – Core Concepts
4
Effective Routing Techniques
Technical requirements
Creating Dynamic Pages
Creating Server Pages
load()
Page options
Actions
API Endpoints
Creating Layouts
Summary
Resources
5
Deep Dive into Data Loading
Technical requirements
Loading in Clients
Loading in Layouts
Destructuring RequestEvent
Summary
Resources
6
Forms and Data Submission
Technical requirements
Form Setup
Analyzing Actions
Database setup
Passwords and Security
Login Action
Enhancing Forms
enhance
Snapshots
Summary
Resources
7
Advanced Routing Techniques
Technical requirements
Using optional parameters
Rest parameters
Matching, sorting, and encoding – oh, my!
Matching
Sorting
Encoding
Advanced layouts
Summary
Resources
Part 3 – Supplemental Concepts
8
Builds and Adapters
Technical requirements
Creating a Build
Adapting the app
adapter-node
adapter-cloudflare
adapter-static
Summary
Resources
9
Hooks and Error Handling
Technical requirements
Using Hooks
Server hooks
Shared hooks
Error Handling
Summary
Resources
10
Managing Static Assets
Technical requirements
Importing Assets
Additional Information
Images versus Styles
Customizing Imports
File Paths
SvelteKit Configuration Options
Vite Configuration Options
Summary
Resources
11
Modules and Secrets
Technical requirements
SvelteKit Module Summaries
$app/environment
$app/forms
$app/navigation
$app/paths
$app/stores
$service-worker
Keeping secrets safe
$env/static/private
$env/static/public
$env/dynamic/private
$env/dynamic/public
Summary
Resources
12
Enhancing Accessibility and Optimizing SEO
Technical requirements
Compile-Time Checks
Announcing routes
Accessibility enhancements
SEO Tips
Summary
Resources
Appendix
Examples and Support
Technical requirements
Integrations
More Reading and Resources
SvelteKit Documentation
SvelteKit Tutorial
Svelte and SvelteKit chat
Independent Creators
Svelte Society
SvelteKit Repository
Wrapping up
Summary
Resources
Index
Why subscribe?
Other Books You May Enjoy
Packt is searching for authors like you
Share Your Thoughts
Download a free PDF copy of this book