Skip to content

Latest commit

 

History

History
117 lines (90 loc) · 5.57 KB

README.md

File metadata and controls

117 lines (90 loc) · 5.57 KB

AstroSharp documentation

Write the coded parts of an Astro site in C# instead of TypeScript. Components, pages, content loaders, actions, endpoints and middleware can all be authored in C#, while Node and Vite continue to drive the build.

These pages mirror Astro's own documentation, section for section and page for page. Read a topic there, then read the same page here for what changes when the code is C#. Every page shows the TypeScript, the C# equivalent, and what the C# cannot do.

New here? Installation, then Islands architecture — it is the one idea that shapes everything else.


Welcome, world!

Page
Why AstroSharp? What it is, and what it deliberately is not.
Islands architecture C# renders on the server, and what it costs not to. Read this first.

Start a new project

Page
Installation npm install astrosharp, plus the .NET SDK.
Project structure Where C# lives, and the generated .astrosharp/.
Develop and build Hot reload, and the changes that restart the dev server.

Configuration

Page
Configuration overview How astro.config.mjs behaves with C# in the project.
AstroSharp options Every option the integration takes.
Services and startup IServiceCollection, Startup, and what is already registered.
Editor setup IntelliSense against the generated project.
TypeScript The ambient declarations, and how far props are typed.
Environment variables astro:env from C#, against the same schema.
Working with integrations What astrosharp() registers, and composing with others.

Routing and navigation

Page
Pages .razor files as routes, prerender, partial.
Routing Dynamic routes, GetStaticPaths, pagination.
Endpoints IAstroEndpoint, verbs, AstroResults, typed endpoints.
Middleware IAstroMiddleware, locals, ordering, rewrites.
Internationalization Astro.I18n, and the helpers with no wrapper.
View transitions <ClientRouter /> from a C# page.

Build your UI

Page
Components Razor components, props, slots, placing .astro and islands from C#.
Layouts [AstroLayout], and the escape hatch for islands.
Styles and CSS Scoped <style>, and what Vite cannot reach.
Fonts <Font> from C#, and the config that feeds it.
Syntax highlighting Free for loader-supplied Markdown.
Scripts and event handling Bundled by Astro, as an .astro script is.
Client rendering Experimental: a .razor component as an interactive island.
Front-end frameworks C# and React on the same page, and islands from a C# page.

Add content to your site

Page
Markdown Supplying Markdown from a loader.
Content collections Loaders, reflected schemas, references, live collections.
Images <Image>, <Picture>, and getImage() from C#.
Data fetching HttpClient, NuGet, and injected services.

Server rendering

Page
On-demand rendering off / sidecar / wasm, and what each costs.
Server islands Unsupported, and why.
Actions IAstroAction<,>, validation, forms, reading results.
Sessions Astro.Session, synchronous.
Route caching Astro.Cache and routeRules.

Upgrade

Page
Upgrade Astro Which Astro version each feature needs.

Reference

Page
Astro template syntax Astro expressions to Razor, and directive support.
Imports Astro.Import against Astro's import types, one by one.
Runtime API The Astro global, member by member.
Runtime API modules astro:* in C#, and the escape hatch.
Experimental features The two experimental blocks, and which flag belongs in which.

Guides

Page
Testing Rendering a C# component with Astro's Container API.
Troubleshooting The errors AstroSharp produces, and what each means.
Migrate to Astro Arriving from ASP.NET Core.

Not an Astro page

Page
How AstroSharp works The sidecar, the host protocol, the integration surface, dev reload. Read this to work on AstroSharp rather than with it.