An Interest In:
Web News this Week
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
- April 18, 2024
- April 17, 2024
Next.js starter cookbook
Introduction
If you're like me, and you tend to start many new Next.js projects the same way, you might consider creating your own template. It's easier than you think, so let's keep it short and get straight to the action!
How-to
At first, let's generate a Next.js project as you usually would.
yarn create next-app# ornpx create-next-app
You will be asked for a name for your new project. Of course, you can choose any name you like, but in general, the naming pattern for starters looks like this - next-[name]-starter
.
Once your project is generated, you can make any changes as you like. Also, it's a good practise to let your potential users know how to quickly create a project with your starter, for this you can use README.md
file.
To start working with your new template, at first you have to upload it to the GitHub repository. Let's navigate to the https://github.com/new and create a new repo, then follow the steps or this tutorial on how to upload your local repo to GitHub.
At the moment your template has been uploaded to the GitHub repo you're ready to use it, simply run one of the following commands and enjoy!
yarn create next-app [project-name] -e [link-to-repo]# ornpx create-next-app [project-name] -e [link-to-repo]
Share the templates that you've created in the comment section below, or simply let me know what you think.
Thanks for reading!
Original Link: https://dev.to/rgolawski/nextjs-starter-cookbook-4mha
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To