30
loading...
This website collects cookies to deliver better user experience
.astro
files are mostly HTML, but with some extra JavaScript goodies. If you're comfortable with HTML and JS, you'll be comfy in .astro
..astro
files borrow concepts from JSX and Frontmatter to make some pretty powerful templates. For example:--------
// Area A
import MyComponent from './MyComponent.astro'
let name = 'Cassidy'
let food = ['apple', 'banana', 'cake']
--------
<!--Area B-->
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<MyComponent></MyComponent>
{name} was here
<ul>
{food.map((item) => (
<li>{item}</li>
))}
</ul>
</body>
</html>
<head>
, and a lot more..astro
files can also take in props
, so you can use them as components within each other, and import given values in the Frontmatter!.astro
components than I've mentioned here, here's the docs if you'd like to read more..md
files you might make), and you can use a <Markdown>
component in your .astro
files, too!<MyComponent client:load />
will render MyComponent
on page load<MyComponent client:idle />
will render MyComponent
as soon as the main thread is free<MyComponent client:visible />
will render MyComponent
when the element enters the viewport (so when a user scrolls to it)pages/
directory already built, and any .astro
or .md
files inside of it automatically become routes in your application.import
statements to your heart's content. Adios, require
!npm init astro
npm install
and initialize your git repo if you'd like, and run it with npm start
.astro.config.js
.npm init astro my-new-project --template cassidoo/astro-netlify-starter