component
nx g @geekvetica/nx-astro:component Button --project=my-appCreates 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.
Options
Section titled “Options”| 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. |
Example
Section titled “Example”nx g @geekvetica/nx-astro:component Input --project=my-app --directory=ui/forms --exportThis 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';