Name: svelte-upgrade
Owner: Svelte
Description: Upgrade your Svelte templates for version 2
Created: 2018-04-12 03:55:29.0
Updated: 2018-05-01 08:58:45.0
Pushed: 2018-04-21 00:19:50.0
Homepage: null
Size: 60
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Upgrade your Svelte templates for compatibility with version 2.
To update all the templates in the src
directory:
svelte-upgrade v2 src
To update an individual component:
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.
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.
before -->
class="item {{active ? 'highlighted' : ''}}">
name}}
v>
after -->
class="item {active ? 'highlighted' : ''}">
ame}
v>
before -->
f foo}}
>foo</p>
seif bar}}
>bar</p>
se}}
>neither foo nor bar</p>
f}}
after -->
foo}
>foo</p>
seif bar}
>bar</p>
se}
>neither foo nor bar</p>
}
before -->
#each cats as cat @name}}
<li><a target='_blank' href={{cat.video}}>{{cat.name}}</a></li>
/each}}
>
after -->
each cats as cat (cat.name)}
<li><a target='_blank' href={cat.video}>{cat.name}</a></li>
each}
>
before -->
ndow on:resize='handleResize()'/>
after -->
lte:window on:resize='handleResize()'/>
before -->
mponent {Thing}/>
after -->
lte:component this={Thing}/>
before -->
:bar/>
after -->
{bar}/>
before -->
class='blog-post'>
{post.content}}}
v>
after -->
class='blog-post'>
html post.content}
v>
before -->
ton on:click="store.set({ clicked: true })">click me</button>
after -->
ton on:click="$set({ clicked: true })">click me</button>