Astro 2.0 | Astro
Introducing Astro 2.0! Astro is a well-liked net framework for constructing performant, content-focused web sites. Our next-gen frontend structure (generally known as Astro Islands) can optimize your website to load 33% faster with 90% less JavaScript utilizing the UI frameworks you already love like React, Svelte, and Vue.
Astro 2.0 is the primary main net framework to ship full type-safety for Markdown and MDX. Astro now helps you manage your Markdown with built-in parsing, validation, and computerized TypeScript sort technology. This new launch is a game-changer for anybody working with Markdown on the net.
The total record of launch highlights embody:
Astro 2.0 is accessible on npm at the moment. Run npm i astro@newest
to improve an current mission, or go to astro.new begin a brand new one from scratch (proper in your browser).
Automated Kind-Security for Markdown & MDX
Astro 2.0 goals to sort out an ignored drawback in trendy net growth: working with Markdown/MDX is difficult.
When you will have lots of of various recordsdata — weblog posts, newsletters, merchandise — it may be unimaginable to maintain consistency in test. One lacking or misspelled frontmatter property and BOOM! Your complete web site can crash with an unhelpful can not learn undefined
error so that you can repair.
Astro 2.0 reimagines the developer expertise round content material with our new Content material Collections API. Arrange your Markdown and MDX recordsdata into totally different collections (like “weblog”
, “e-newsletter”
, "merchandise"
) and Astro takes care of the remainder:
- Schema validation
- search engine marketing finest practices
- Informative error messages
- Automated generated varieties
- Inline sort errors, autocomplete and extra!
To be taught extra about content material collections, take a look at our featured publish: Introducing Content Collections: Type-Safe Markdown in Astro 2.0.
Hybrid Rendering: Static Meets Dynamic
For nearly a 12 months now, Astro has allow you to select between static (SSG) and server (SSR) construct output. Static web sites provide unimaginable efficiency, but they lack the flexibility to generate HTML on-demand for every request.
Astro 2.0 brings collectively the most effective of each worlds with Hybrid Rendering. Hybrid rendering provides you the selection to prerender sure pages with out giving up your deployed server. Prerendering builds pages ahead-of-time so that each one of these requests load immediately.
Mixing static and dynamic content material collectively unlocks fully new prospects for Astro, together with:
- Enhance render efficiency of in style pages
- Enhance construct efficiency of enormous websites
- Add an API to your current static website
Be taught extra about hybrid rendering on our docs website. Test again later this week for a fair deeper dive into the world of hybrid rendering with Nate Moore.
Errors, Redesigned
The error overlay is an important items of UI that Astro ships. When one thing goes mistaken, it’s the very first thing you see as a developer. While you go to debug a difficulty, it’s typically the primary place you begin.
Astro 2.0 utterly redesigns the error expertise with a model new, Astro look-and-feel. Moreover, the brand new error overlay highlights extra data than earlier than, like useful hints to resolve the error and a button that jumps to your code in your favourite editor.
Dev Server Optimizations
Astro 2.0 highlights a number of months of funding to enhance the efficiency and reliability of the Astro dev server, particularly round Sizzling Module Reloading (HMR).
Astro customers have benefitted from the incremental launch of those enhancements over the previous couple of months, culminating in at the moment’s launch. Astro 2.0 marks the primary time that each one of those enhancements can be found collectively, in a single launch.
Vite 4.0
Astro 2.0 features a main inside improve to certainly one of our most essential inside dependencies: Vite.
Vite is a crucial device that powers Astro’s inside construct engine. Vite 4.0 — the newest launch from the Vite workforce — contains a number of essential enhancements and bug fixes that profit all Astro customers.
A few of these enhancements in Vite 4.0 come from our very personal teammate Bjorn Lu, who can be a maintainer on the Vite mission. His investigations to enhance Vite efficiency for Astro led to several pull requests to Vite 4.0, which are actually obtainable for all Vite customers to learn from. Thanks, Bjorn!
The Astro Open Roadmap
Final however not least, we’re excited to formally launch the brand new Public Roadmap for Astro.
Astro has at all times had an open RFC course of. Anybody can suggest a brand new concept for a function, and our group would meet to debate these concepts throughout weekly calls on Discord.
In follow, nevertheless, our RFC course of didn’t present sufficient steering to contributors. RFCs are prolonged, detailed paperwork that take appreciable effort to create. Some discovered the method daunting. Others created RFCs solely to appreciate later that their concept both wasn’t possible. Each eventualities left us pissed off.
Our new roadmap addresses these shortcomings by decreasing the barrier to entry for brand spanking new concepts and proposals. New concepts might be mentioned and even accepted (learn: prioritized) earlier than a proper RFC is ever written. Astro maintainers may also give steering even earlier within the course of, to assist floor issues and talk about function precedence.
You may learn extra about our new roadmap within the withastro/roadmap repo. In case you have a function request for Astro, head over to the repo to get entangled.
Astro 2.0 is accessible on npm at the moment. Improve an current mission by operating npm i astro@newest
or begin a brand new Astro mission proper in your browser by visiting astro.new.
Searching for extra? Tune right into a particular Twitter space this afternoon at 12pm PST feat. Cassidy Williams! You may also take a look at these superior launch-day movies and tutorials to be taught extra: