Skip to content

component

Terminal window
nx g @geekvetica/nx-astro:component Button --project=my-app

Creates src/components/Button.astro in the project, with props, markup and a style block to fill in. The file name is the name you pass, unchanged. The generator has the aliases @geekvetica/nx-astro:c and @geekvetica/nx-astro:comp.

Option Type Default Description
name (required) string none Component name, the first positional argument.
project (required) string none Name of the Astro project.
directory string none Directory below src/components, such as ui/forms.
export boolean false Adds an export of the component to src/components/index.ts.
skipFormat boolean false Does not format the generated files.
Terminal window
nx g @geekvetica/nx-astro:component Input --project=my-app --directory=ui/forms --export

This creates src/components/ui/forms/Input.astro and adds this line to src/components/index.ts:

export { default as Input } from './ui/forms/Input.astro';
nx-astro 3.2.0 · MIT Developed by