Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 26, 2022 12:38 pm GMT

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

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To