Slim, speedy Svelte framework puts JavaScript on a diet

Slim, speedy Svelte framework puts JavaScript on a diet

While there's already a plethora of JavaScript frameworks available, there always seems to be room for another trying to provide something new. Enter the Svelte framework, which focuses on building apps for speed by converting them into pure vanilla JavaScript.

Svelte, available in a 1.0.0 release, turns templates into framework-less JavaScript. Developers write components using HTML, CSS, and JavaScript; the Svelte build process compiles them into standalone JavaScript modules.

"By statically analyzing the component template, we can make sure that the browser does as little work as possible," said Rich Harris, Svelte founder and interactive editor at The Guardian. Svelte applications run faster than those from other JavaScript frameworks, including React, Vue, Angular, and Ember.

Frameworks like React solved the productivity problem of how to build rich, complex applications without creating a "pile of unmaintainable spaghetti code," said Harris. And the front end community abandoned old ideas about separation of concerns and embraced a component-driven mindset. But this has come at a cost to users.

"Existing frameworks tend to be large enough that your application becomes slow to start up on mobile phones, especially on Android, which is where the bulk of market growth is happening." Browsers have had to spend time parsing and evaluating JavaScript, during which time a phone is unresponsive, then there's a performance cost to framework abstractions. "Svelte solves these problems by removing those abstractions. The hard work happens at compile time rather than run time -- it spits out highly optimized low-level DOM manipulation code specific to your application."

Svelte's compiler detects which features a component uses by analyzing source code. "If a feature isn't being used, Svelte doesn't include the code for it," said Harris. "You end up with exactly what you need." The framework also offers advantages in code-splitting and supports capabilities like SVG and encapsulated CSS.

There still is plenty of work left to do on Svelte, Harris cautioned. It must be fitted with capabilities like server-side rendering and be integrated with existing tools, and he wants to add features like declarative translations.

IDG Insider

PREVIOUS ARTICLE

«Intel's silence on Optane SSDs raises questions about launch and focus

NEXT ARTICLE

Mozilla's revenue jumps 28% in first full year of Yahoo search deal»
author_image
IDG Connect

IDG Connect tackles the tech stories that matter to you

Add Your Comment

Most Recent Comments

Our Case Studies

IDG Connect delivers full creative solutions to meet all your demand generatlon needs. These cover the full scope of options, from customized content and lead delivery through to fully integrated campaigns.

images

Our Marketing Research

Our in-house analyst and editorial team create a range of insights for the global marketing community. These look at IT buying preferences, the latest soclal media trends and other zeitgeist topics.

images

Poll

Will Kotlin overtake Java as the most popular Android programming language in 2018?