Schematics for Astro
Astro Schematics is here to make your life easier by taking care of repetitive tasks. With it, you can quickly create components, layouts, and pages for your Astro projects. This magic is brought to you by Project Builder.
Get Started in a Snap
Just run this command in your project folder:
Things to Know
-
Installing the CLI: When you run the above command, it might ask if you want to install something called a CLI (Command Line Interface). Here’s why you should say yes:
@pbuilder/astro-cli
(or pastro): This special tool is made just for Astro. It makes making new parts of your website (like pages and components) super easy with simple commands.- Learning More: If you’re curious about what commands you can do, just add —help to see all your options.
Let’s Create Something
Components
Want to make a new component? Easy peasy:
Or:
Layouts
Need a new layout? Just as easy:
Alternatively:
Pages
For page creation, specify the type (astro is the default one) and layout:
Or use the direct method:
What If I Need Something More?
Beyond Astro CLI
Sometimes, you might need a tool that isn’t just for Astro. That’s where @pbuilder/cli
comes in. It’s a more general tool that works for a bunch of different projects.
Here’s how you use it:
Like making a component without the Astro-specific tool: