Skip to content

Commit ceacabb

Browse files
committed
Added prefix utility
1 parent a0e7c4c commit ceacabb

File tree

6 files changed

+10
-5
lines changed

6 files changed

+10
-5
lines changed

.env.example

-1
This file was deleted.

.github/workflows/node.js.yml

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
- name: Installing my packages
2323
run: npm ci
2424

25+
- name: Extract repository name
26+
run: echo "BASE_URL=$(echo $GITHUB_REPOSITORY | cut -d '/' -f 2)" >> $GITHUB_ENV
27+
2528
- name: Build my App
2629
run: npm run build && touch ./out/.nojekyll
2730

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,3 @@ yarn-error.log*
3333

3434
# typescript
3535
*.tsbuildinfo
36-
37-
.env

next.config.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const nextConfig = {
77
loader: "akamai",
88
path: "",
99
},
10+
assetPrefix: "./",
1011
};
1112

1213
export default nextConfig;

pages/index.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import type { NextPage } from "next";
22
import Head from "next/head";
33
import Image from "next/image";
44
import styles from "../styles/Home.module.css";
5+
import { prefix } from "../utils/prefix";
56

67
const Home: NextPage = () => {
78
return (
89
<div className={styles.container}>
910
<Head>
1011
<title>Create Next App</title>
1112
<meta name="description" content="Generated by create next app" />
12-
<link rel="icon" href="/favicon.ico" />
13+
<link rel="icon" href={`${prefix}/favicon.ico`} />
1314
</Head>
1415

1516
<main className={styles.main}>
@@ -62,7 +63,7 @@ const Home: NextPage = () => {
6263
Powered by{" "}
6364
<span className={styles.logo}>
6465
<Image
65-
src={`${process.env.BASE_PATH}/vercel.svg`}
66+
src={`${prefix}/vercel.svg`}
6667
alt="Vercel Logo"
6768
width={72}
6869
height={16}

utils/prefix.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const prefix = process.env.BASE_PATH || "";
2+
3+
export { prefix };

0 commit comments

Comments
 (0)