Wat is het ASTRO-bestandsformaat?
Een .astro-bestand is een component die wordt gebruikt door Astro, een open-source webframework voor contentgerichte sites zoals blogs, documentatie en marketingpagina's. Fred K. Schott creëerde Astro in 2021, en het bereikte een stabiele 1.0 in augustus 2022. Het project wordt nu onderhouden onder de MIT-licentie nadat Cloudflare de Astro Technology Company overnam in januari 2026.
Elk bestand heeft twee delen die gescheiden worden door een --- code-omheining. Boven de omheining bevindt zich het componentscript, of frontmatter, geschreven in JavaScript of TypeScript. Dit wordt uitgevoerd tijdens de build om andere componenten te importeren, gegevens op te halen en variabelen te declareren. Onder de omheining bevindt zich het sjabloon, een HTML-achtig blok dat {} expressies, <slot /> placeholders en gescopete <style> en <script> tags accepteert. De syntaxis is een uitbreiding van .html en leest grotendeels als JSX, hoewel het standaard kebab-case attributen gebruikt.
Astro rendert componenten vooraf naar HTML en verzendt standaard geen client-side JavaScript. Interactieve onderdelen worden selectief toegevoegd via de „islands architecture” met behulp van client:* richtlijnen op framework-componenten.
Beveiliging & veiligheid
RISICO: LOWAn .astro file is human-readable source text and cannot run on its own by double-clicking. It only executes when compiled by the Astro toolchain during a build. As with any project source, its frontmatter can contain JavaScript, so review files from untrusted repositories before running npm install or a build, since build scripts and dependencies (not the .astro file itself) are the real risk.
Formaatdetails
in een notendop- ASTRO-VISION LifeSign / horoscope data - Some astrology software has used .astro for chart or profile data files. Unrelated to the web framework.
- Generic astronomy/astrology data exports - Occasionally seen as an ad hoc extension for star-chart or ephemeris data in niche tools.
Programma's die ASTRO-bestanden openen
.astro files. .astro components. npm run dev or astro build to compile .astro files into HTML and preview the site. .astro files with full language support. astro dev and astro build in Terminal to run and compile the project. .astro files. npm run dev or npx astro build from the terminal to serve or compile .astro files. Technische details
diepe specificaties| Encoding | UTF-8 plain text |
| Byte order | Not applicable (text) |
| Container | None; single source file |
| Typical size | A few hundred bytes to tens of kilobytes |
| Structure | Two sections separated by a --- code fence: an optional component script (frontmatter) written in JavaScript/TypeScript that runs at build time or on the server, followed by a component template made of HTML-like markup with {} expressions, directives, <slot />, <style> and <script> tags. |
| Integrity | None built in |
| Platforms | Windows, macOS, Linux |
| Notes | Astro components render to HTML ahead of time and ship no client-side JavaScript runtime by default. Interactive framework components can be hydrated selectively using client:* directives (the islands architecture). The Astro compiler parses .astro files and outputs HTML plus any scoped CSS and hydration code. |
| Syntax Basis | Superset of HTML, close to JSX but using standard kebab-case HTML attributes |
| Runtime | Server/build-time rendering; no default client runtime |
| Language Support | JavaScript and TypeScript in the frontmatter, including top-level await |
| Uitgebracht | 2021 |
| Laatste versie | Astro 6 (March 2026) |
| Specificatie | docs.astro.build |
ASTRO conversies
Community V&A
gevraagd door gebruikersNog geen vragen - wees de eerste om iets te vragen over ASTRO-bestanden.
Veelgestelde vragen
Hoe open ik een .astro-bestand?
Kan ik een .astro-bestand in een browser bekijken?
npm run dev of bouwt het met astro build, waarna Astro de component omzet in HTML die de browser vervolgens weergeeft.Welk programma maakt .astro-bestanden?
.astro-bestanden bevatten.Is een .astro-bestand hetzelfde als HTML?
Waarom heeft mijn .astro-bestand JavaScript bovenaan?
--- lijnen, is het componentscript of de frontmatter. Het wordt uitgevoerd tijdens de build om componenten te importeren, gegevens op te halen en variabelen in te stellen die in het onderstaande sjabloon worden gebruikt.