Nuxt/docs/content/3.api/5.commands/add.md
Clément Ollivier 9a0fc57724
docs: update sitemap (#4063)
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
Co-authored-by: pooya parsa <pyapar@gmail.com>
2022-04-06 07:56:08 +02:00

986 B

nuxi add

Scaffold an entity into your Nuxt application.

npx nuxi add [--cwd] [--force] <TEMPLATE> <NAME>
Option Default Description
TEMPLATE - Specify a template of the file to be generated.
NAME - Specify a name of the file that will be created.
--cwd . The directory of the target application.
--force false Force override file if it already exists.

Example:

npx nuxi add component TheHeader

The add command generates new elements:

  • component: npx nuxi add component TheHeader
  • composable: npx nuxi add composable foo
  • layout: npx nuxi add layout custom
  • plugin: npx nuxi add plugin analytics
  • page: npx nuxi add page about or npx nuxi add page "category/[id]"
  • middleware: npx nuxi add middleware auth
  • api: npx nuxi add api hello (CLI will generate file under /server/api)