diff --git a/apps/svelte.dev/README.md b/apps/svelte.dev/README.md index 601d924e0e..2d86130372 100644 --- a/apps/svelte.dev/README.md +++ b/apps/svelte.dev/README.md @@ -1,38 +1,25 @@ -# create-svelte +# svelte.dev -Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte). +This is the app behind [svelte.dev](https://svelte.dev), the official Svelte site. -## Creating a project +## Development -If you're seeing this, you've probably already done this step. Congrats! +### Tutorial -```bash -# create a new project in the current directory -npx sv create +The tutorial consists of two technically different parts: The Svelte tutorial and the SvelteKit tutorial. The SvelteKit tutorial uses [WebContainers](https://webcontainers.io/) under the hood in order to boot up a Node runtime in the browser. The Svelte tutorial uses Rollup in a web worker - it does not use WebContainers because a simple web worker is both faster and more reliable (there are known issues with iOS mobile). -# create a new project in my-app -npx sv create my-app -``` - -## Developing - -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: - -```bash -npm run dev +WebContainers require [cross-origin isolation](https://webcontainers.io/guides/quickstart#cross-origin-isolation), which means the document needs to have these headers: -# or start the server and open the app in a new browser tab -npm run dev -- --open +``` +Cross-Origin-Embedder-Policy: require-corp +Cross-Origin-Opener-Policy: same-origin ``` -## Building - -To create a production version of your app: +Because we're doing soft navigation between pages, these headers need to be set for all responses, not just the ones from `/tutorial`. -```bash -npm run build -``` +The result of setting these headers is that the site can no longer embed URLs from other sites (like images from another domain) without those domains either having a `cross-origin-resource-policy: cross-origin` header (which most don't) or us adding the `crossorigin="anonymous"` attribute to the elements that load those URLs. -You can preview the production build with `npm run preview`. +When writing content for the tutorial, you need to be aware of the differences of loading content: -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. +- When using root-relative paths, for a SvelteKit exercise the 'root' is the `static` directory inside the exercise itself, but for a Svelte exercise it is the root of the app so assets should do inside `apps/svelte.dev/static/tutorial`. +- When importing relative assets in a Svelte exercise, Rollup inlines them into the bundle as base64 diff --git a/apps/svelte.dev/content/blog/2019-01-31-svelte-on-the-changelog.md b/apps/svelte.dev/content/blog/2019-01-31-svelte-on-the-changelog.md index ca5805ac6d..6f965e050c 100644 --- a/apps/svelte.dev/content/blog/2019-01-31-svelte-on-the-changelog.md +++ b/apps/svelte.dev/content/blog/2019-01-31-svelte-on-the-changelog.md @@ -18,4 +18,4 @@ Unless you hang out in our [Discord server](https://svelte.dev/chat) or follow [ On the podcast [Adam](https://twitter.com/adamstac), [Jerod](https://twitter.com/jerodsanto) and I talk about some of the changes and why we're making them. You can listen here or on the [podcast page](https://changelog.com/podcast/332). -
The Changelog 332: A UI framework without the framework – Listen on Changelog.com
+The Changelog 332: A UI framework without the framework – Listen on Changelog.com
diff --git a/apps/svelte.dev/content/blog/2019-04-22-svelte-3-rethinking-reactivity.md b/apps/svelte.dev/content/blog/2019-04-22-svelte-3-rethinking-reactivity.md index a4dd7b2b3b..d358b662ed 100644 --- a/apps/svelte.dev/content/blog/2019-04-22-svelte-3-rethinking-reactivity.md +++ b/apps/svelte.dev/content/blog/2019-04-22-svelte-3-rethinking-reactivity.md @@ -24,7 +24,7 @@ To make that possible we first needed to rethink the concept at the heart of mod