# π©βπ Astro A next-generation static-site generator with partial hydration. Use your favorite JS framework and ship bare-minimum JS (or none at all!). ## π§ Setup ``` npm install astro ``` TODO: astro boilerplate ## π§ Development Add a `dev` npm script to your `/package.json` file: ```json { "scripts": { "dev": "astro dev ." } } ``` Then run: ``` npm run dev ``` ### βοΈ Configuration To configure Astro, add a `astro.config.mjs` file in the root of your project. All of the options can be omitted. Here are the defaults: ```js export default { /** Where to resolve all URLs relative to. Useful if you have a monorepo project. */ projectRoot: '.', /** Path to Astro components, pages, and data */ astroRoot: './astro', /** When running `astro build`, path to final static output */ dist: './_site', /** A folder of static files Astro will copy to the root. Useful for favicons, images, and other files that donβt need processing. */ public: './public', /** Extension-specific handlings */ extensions: { /** Set this to "preact" or "react" to determine what *.jsx files should load */ '.jsx': 'react', }, }; ``` ### π§ Partial Hydration By default, Astro outputs zero client-side JS. If you'd like to include an interactive component in the client output, you may use any of the following techniques. - `MyComponent:load` will render `MyComponent` on page load - `MyComponent:idle` will use `requestIdleCallback` to render `MyComponent` as soon as main thread is free - `MyComponent:visible` will use an `IntersectionObserver` to render `MyComponent` when the element enters the viewport ### π Styling If youβve used [Svelte][svelte]βs styles before, Astro works almost the same way. In any `.astro` file, start writing styles in a `