Skip to content

Commit

Permalink
Added prefix utility
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveAldon committed Apr 23, 2024
1 parent a0e7c4c commit ceacabb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion .env.example

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
- name: Installing my packages
run: npm ci

- name: Extract repository name
run: echo "BASE_URL=$(echo $GITHUB_REPOSITORY | cut -d '/' -f 2)" >> $GITHUB_ENV

- name: Build my App
run: npm run build && touch ./out/.nojekyll

Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,3 @@ yarn-error.log*

# typescript
*.tsbuildinfo

.env
1 change: 1 addition & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const nextConfig = {
loader: "akamai",
path: "",
},
assetPrefix: "./",
};

export default nextConfig;
5 changes: 3 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import type { NextPage } from "next";
import Head from "next/head";
import Image from "next/image";
import styles from "../styles/Home.module.css";
import { prefix } from "../utils/prefix";

const Home: NextPage = () => {
return (
<div className={styles.container}>
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href={`${prefix}/favicon.ico`} />
</Head>

<main className={styles.main}>
Expand Down Expand Up @@ -62,7 +63,7 @@ const Home: NextPage = () => {
Powered by{" "}
<span className={styles.logo}>
<Image
src={`${process.env.BASE_PATH}/vercel.svg`}
src={`${prefix}/vercel.svg`}
alt="Vercel Logo"
width={72}
height={16}
Expand Down
3 changes: 3 additions & 0 deletions utils/prefix.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const prefix = process.env.BASE_PATH || "";

export { prefix };

0 comments on commit ceacabb

Please sign in to comment.