You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
"[Next.js](https://nextjs.org/) is a React framework for building full-stack web applications. You use React Components to build user interfaces, and Next.js for additional features and optimizations."
6
+
7
+
This guide provides a first-hand experience on building a **Next.js** project with [Tailwind CSS](https://tailwindcss.com/) and deploying it on [GitHub Pages](https://pages.github.com/) using [GitHub Actions](https://github.com/features/actions).
8
+
9
+
## 🛠️ Installation
10
+
11
+
**1. Create your project.**
12
+
13
+
```bash
14
+
# terminal
15
+
npx create-next-app@latest
16
+
```
17
+
18
+
And answer the next prompts based on your project specification needs. <small>[reference here](https://nextjs.org/docs/getting-started/installation)</small>
6
19
7
20
```bash
21
+
What is your project named? project_name
22
+
Would you like to use TypeScript? No / Yes
23
+
Would you like to use ESLint? No / Yes
24
+
Would you like to use Tailwind CSS? No / Yes
25
+
Would you like to use `src/` directory? No / Yes
26
+
Would you like to use App Router? (recommended) No / Yes
27
+
Would you like to customize the default import alias (@/*)? No / Yes
28
+
```
29
+
30
+
**2. Start build process.**
31
+
32
+
```bash
33
+
# terminal
8
34
npm run dev
9
-
# or
10
-
yarn dev
11
-
# or
12
-
pnpm dev
13
-
# or
14
-
bun dev
15
35
```
16
36
17
-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
37
+
**3. Happy coding. ^^**
38
+
39
+
```jsx
40
+
<p className="text-red-400 font-bold mt-10">Tailwind is working.</p>
41
+
```
42
+
43
+
## 🗂️ File Structure
44
+
45
+
Sample project structure for reference.
46
+
47
+
```
48
+
my-nextjs-app/
49
+
├── public/
50
+
│ ├── images/
51
+
│ └── favicon.ico
52
+
├── src/
53
+
│ ├── components/
54
+
│ │ └── Header.js
55
+
│ ├── pages/
56
+
│ │ ├── api/
57
+
│ │ │ └── hello.js
58
+
│ │ └── index.js
59
+
│ ├── styles/
60
+
│ │ ├── globals.css
61
+
│ ├── utils/
62
+
│ │ └── helpers.js
63
+
│ └── hooks/
64
+
│ └── useExample.js
65
+
├── .gitignore
66
+
├── package.json
67
+
├── README.md
68
+
└── next.config.js
69
+
```
70
+
71
+
## 🛫 How to deploy to GitHub Pages
18
72
19
-
You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file.
73
+
Deploying to github pages is totally up to you, be it through **[GitHub Actions](https://docs.github.com/en/actions/deployment/about-deployments/deploying-with-github-actions)**, or via **[gh-pages](https://www.npmjs.com/package/gh-pages)** package, or manually.
20
74
21
-
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
75
+
> [!NOTE]
76
+
>
77
+
> Also take note that [GitHub Pages](https://pages.github.com/) have limitations, it's free, yes, but it has a limit.
22
78
23
-
## Learn More
79
+
### ❗ via GitHub Actions in `Settings > Pages` ❗
80
+
81
+
**1. Modify src paths.**
82
+
83
+
```js
84
+
// page.js
85
+
<Image
86
+
src="./vercel.svg"
87
+
alt="Vercel Logo"
88
+
className="dark:invert"
89
+
width={100}
90
+
height={24}
91
+
priority
92
+
/>
93
+
```
94
+
95
+
**2. Modify `next.config.mjs` to enable static exports.** <small>[reference here](https://nextjs.org/docs/pages/building-your-application/deploying/static-exports)</small>
96
+
97
+
```js
98
+
/**@type{import('next').NextConfig}*/
99
+
constnextConfig= {
100
+
output:'export',
101
+
};
102
+
103
+
exportdefaultnextConfig;
104
+
```
105
+
106
+
**3. Add `actions`.**
107
+
108
+
Use default action configuration from `Settings > Pages` or use the `.github/workflows/publish.yml` file.
109
+
110
+
**4. Visit your deployed site in `Settings > Page`. ^^**
111
+
112
+
### ❗ via manually configuring github pages settings ❗
113
+
114
+
**1. Create your project.**
115
+
Start coding your project, either use a framework like React, Vue, or not.
116
+
117
+
**2. Publish production build to GitHub.**
118
+
Push your _production build_ to your github repo. After that, check if your `index.html` file is uploaded, since it is one of the core files needed for your website to work.
119
+
120
+
**3. Configure your GitHub Pages on repo Settings.**
121
+
Navigate to `Settings > Pages > Build and deployment`. Make sure the **Source** says 'Deploy from a branch', and then configure the **Branch** settings and change it to your branch with the files.
122
+
123
+
---
124
+
125
+
### Learn More
24
126
25
127
To learn more about Next.js, take a look at the following resources:
26
128
@@ -29,8 +131,14 @@ To learn more about Next.js, take a look at the following resources:
29
131
30
132
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31
133
32
-
## Deploy on Vercel
134
+
###Deploy on Vercel
33
135
34
136
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35
137
36
138
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
0 commit comments