Astro
Astro builds with Vite, so Hozo’s Vite plugin is all an Astro project needs.
This documentation site is itself Astro with @hozo/vite.
npm install --save-dev @hozo/vite @hozo/compilernpm install @hozo/core @astrojs/react react react-domimport react from '@astrojs/react'import { hozo } from '@hozo/vite'import { defineConfig } from 'astro/config'
export default defineConfig({ integrations: [react()], vite: { // First: Hozo has to see the source as written, before any other // plugin transforms it. plugins: [hozo({ css: 'src/styles/global.css' })], },})Three things to know
Section titled “Three things to know”- Primitives go in
.tsxcomponents and.mdxpages, not in.astrotemplates. Hozo compiles JSX. An.astrofile can import and render a.tsxcomponent built from primitives, and an.mdxpage can use primitives inline. - A component built only from static primitives ships no JavaScript.
Astro renders it at build time with no
client:directive, and Hozo has already turned it into HTML and a stylesheet. A component with an event handler or a stateful pattern needs aclient:directive like any other React island; without one, Astro renders it and drops the handler. - Beside
@tailwindcss/vite, passpreflight: false. If your own stylesheet already imports Tailwind, it brings Tailwind’s preflight inside@layer base. Hozo’s own copy is unlayered and would override your utilities. Writehozo({ preflight: false }), and puthozo()beforetailwindcss()invite.plugins.