# svelte-upgrade **Repository Path**: mirrors_sveltejs/svelte-upgrade ## Basic Information - **Project Name**: svelte-upgrade - **Description**: Upgrade your Svelte templates for version 2 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-26 - **Last Updated**: 2025-08-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # svelte-upgrade Upgrade your Svelte templates for compatibility with version 2. To update all the templates in the `src` directory: ```bash npx svelte-upgrade v2 src ``` To update an individual component: ```bash npx svelte-upgrade v2 MyComponent.html ``` To specify a different output location, instead of writing in place, use the `--output` (or `-o`) flag. If files will be overwritten, you'll be prompted for confirmation. Use `--force` or `-f` to bypass the prompt. ## Configuring the compiler Prior to the release of Svelte v2, it is possible to opt in to the new syntax by passing the `parser: 'v2'` option to the compiler, either directly or via your rollup-plugin-svelte or svelte-loader options. ## Svelte v2 syntax changes ### Single-curly tags ```html
foo
{{elseif bar}}bar
{{else}}neither foo nor bar
{{/if}} {#if foo}foo
{:elseif bar}bar
{:else}neither foo nor bar
{/if} ``` ### Keyed each blocks ```html