Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update assets base path loading for production #40

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
/* eslint-disable no-undef */
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
basePath: "",
images: {
remotePatterns: [
{
protocol: "https",
hostname: "abolfazlcodes.github.io",
port: "",
pathname: "/arman/**",
},
],
},
};

export default nextConfig;
5 changes: 4 additions & 1 deletion src/app/(home)/_components/HomeHeroSection.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { NEXT_BASE_PATH } from "@/constants";
import { Fira_Code } from "next/font/google";
import Image from "next/image";

const firaCode = Fira_Code({
subsets: ["latin"],
weight: ["300", "400", "500", "700", "600"],
preload: true,
});

const HomeHeroSection = () => {
Expand Down Expand Up @@ -32,7 +34,8 @@ const HomeHeroSection = () => {

<figure className="h-[320px] w-[250px] rotate-6 overflow-hidden rounded-20 shadow-heroImage2 transition-all duration-100 ease-linear hover:-rotate-2 sm:h-[370px] sm:w-[330px] md:order-2 md:h-[400px] md:w-[360px]">
<Image
src={"/images/hero-img.jpeg"}
// src={`/images/hero-img.jpeg`}
src={`${NEXT_BASE_PATH}/images/hero-img.jpeg`}
alt="arman photo"
fill
className="h-full w-full object-cover object-center"
Expand Down
1 change: 1 addition & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const NEXT_BASE_PATH = process.env.NEXT_PUBLIC_BASE_PATH || "";