Svelte

Svelte is a free and open-source front end[4] JavaScript framework[5] created by Rich Harris and maintained by Harris and other Svelte core team members.[6] Svelte applications do not include framework references. Instead, building a Svelte application generates code to manipulate the DOM, which may reduce the size of transferred files as well as give better client startup and run-time performance. Svelte has its own compiler for converting app code into client-side JavaScript at build time. It is written in TypeScript.[7][8] The Svelte source code is licensed under MIT License and hosted on GitHub.[9]

Svelte
Original author(s)Rich Harris
Initial releaseNovember 26, 2016 (2016-11-26)[1]
Stable release
3.31.2 / January 4, 2021 (2021-01-04)[2]
RepositorySvelte Repository
Written inTypeScript
PlatformWeb platform
Size4.1 KB[3]
TypeWeb framework
LicenseMIT License
Websitesvelte.dev

History

The predecessor of Svelte is Ractive.js, which Rich Harris had developed earlier.

Version 1 of Svelte was written in JavaScript and was released in 29 November 2016.

Version 2 of Svelte was released in 19 April 2018.

Version 3 of Svelte is written in TypeScript and was released in 21 April 2019.

Example

Svelte applications and components are defined in .svelte files, which are HTML files extended with templating syntax that is similar to JSX. Svelte repurposes JavaScript's label syntax $: to mark reactive statements. Top-level variables become the component's state and exported variables become the properties that the component receives.

<script>
    let count = 1;
    $: doubled = count * 2;
</script>

<p>{count} * 2 = {doubled}</p>

<button on:click={() => count = count + 1}>Count</button>

Influence

Vue.js modelled its API and single-file components after Ractive.js, the predecessor of Svelte.

See also

References

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.