nuxt / nuxt/cli

Feature request: Ability to overload and customise the templates

Open
#1,136 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
Dominant language
TypeScript
Stars
399
Forks
119
Avg merge
20h 59m
Merged PRs (30d)
65

Description

Summary

Our project uses Nuxt and also Nuxt UI. We need to add a variety of Nuxt UI parts to our templates and things like Authorization from Nuxt Authorization. We use the npx nuxt add often to make our components, pages and apis and it would be super helpful for us to create our own templates in our project so we can automate much of our daily boilerplate.

This is a feature pattern that I'm familiar with from CakePHP, https://book.cakephp.org/bake/3/en/development.html#creating-a-bake-theme

Proposal

I don't think it needs to be complex, perhaps it follows the Nuxt folder organisation and there is a stubs folder in / of the project, and the code can simply look for that folder and if it exists, it tries to load the template from there, or falls back to the current functionality.

Code

https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/add.ts#L74-L75

Perhaps a resolver is needed to encapsulate the functionality, but a smell change here might work?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/nuxi/src/commands/add.ts at the referenced lines and trace how nuxi add resolves its current templates. Define how a project-level stubs folder should follow Nuxt organization, override built-in templates, and fall back when no custom template exists. Done means nuxi add supports customized components, pages, and APIs without breaking the existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.