This content originally appeared on DEV Community and was authored by Rafał Goławski
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
# or
npx 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]
# or
npx 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! 👋
This content originally appeared on DEV Community and was authored by Rafał Goławski
Rafał Goławski | Sciencx (2022-04-26T12:38:23+00:00) Next.js starter cookbook 👨🍳. Retrieved from https://www.scien.cx/2022/04/26/next-js-starter-cookbook-%f0%9f%91%a8%f0%9f%8d%b3/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.