From 1560e06afb4fffad01465d97430ff758877bc810 Mon Sep 17 00:00:00 2001 From: Youngbin Han Date: Sun, 14 Jan 2024 13:58:19 +0900 Subject: [PATCH] Use alias and absolute path for importing other code/assets --- src/{ => assets}/UbuntuIndia.svg | 0 src/{pages => assets}/logo.svg | 0 src/{pages => assets}/logo_placeholder.svg | 0 src/config.ts | 2 +- src/layouts/MarkdownLayout.astro | 3 +-- src/layouts/Shell.astro | 4 ++-- src/pages/about.mdx | 2 +- src/pages/index.astro | 8 ++++---- src/pages/venue-and-travel/accommodations.mdx | 2 +- src/pages/venue-and-travel/explore-city.mdx | 2 +- src/pages/venue-and-travel/getting-to-city.mdx | 2 +- src/pages/venue-and-travel/travel-grant.mdx | 2 +- src/pages/venue-and-travel/venue-and-safety.mdx | 2 +- tsconfig.json | 8 +++++++- 14 files changed, 21 insertions(+), 16 deletions(-) rename src/{ => assets}/UbuntuIndia.svg (100%) rename src/{pages => assets}/logo.svg (100%) rename src/{pages => assets}/logo_placeholder.svg (100%) diff --git a/src/UbuntuIndia.svg b/src/assets/UbuntuIndia.svg similarity index 100% rename from src/UbuntuIndia.svg rename to src/assets/UbuntuIndia.svg diff --git a/src/pages/logo.svg b/src/assets/logo.svg similarity index 100% rename from src/pages/logo.svg rename to src/assets/logo.svg diff --git a/src/pages/logo_placeholder.svg b/src/assets/logo_placeholder.svg similarity index 100% rename from src/pages/logo_placeholder.svg rename to src/assets/logo_placeholder.svg diff --git a/src/config.ts b/src/config.ts index 24508de..d7c0529 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,4 +1,4 @@ -import UbuntuIndiaLogo from "./UbuntuIndia.svg" +import UbuntuIndiaLogo from "@assets/UbuntuIndia.svg" export const config = { siteTitle: "UbuCon Asia 2024", diff --git a/src/layouts/MarkdownLayout.astro b/src/layouts/MarkdownLayout.astro index f9ccbec..13e68b4 100644 --- a/src/layouts/MarkdownLayout.astro +++ b/src/layouts/MarkdownLayout.astro @@ -1,7 +1,6 @@ --- import "vanilla-framework/_index.scss"; -import GlobalNavigation from "../components/GlobalNavigation"; -import Shell from "./Shell.astro"; +import Shell from "@layouts/Shell.astro"; import { Strip, Col, Row } from "@canonical/react-components"; import type { MarkdownLayoutProps } from 'astro'; diff --git a/src/layouts/Shell.astro b/src/layouts/Shell.astro index 8849b2f..83e53e1 100644 --- a/src/layouts/Shell.astro +++ b/src/layouts/Shell.astro @@ -1,7 +1,7 @@ --- import "vanilla-framework/_index.scss"; -import GlobalNavigation from "../components/GlobalNavigation.tsx"; -import Layout from "./Layout.astro"; +import GlobalNavigation from "@components/GlobalNavigation.tsx"; +import Layout from "@layouts/Layout.astro"; interface Props { title: string; diff --git a/src/pages/about.mdx b/src/pages/about.mdx index e3eb1f4..04ea580 100644 --- a/src/pages/about.mdx +++ b/src/pages/about.mdx @@ -1,5 +1,5 @@ --- -layout: ../layouts/MarkdownLayout.astro +layout: /src/layouts/MarkdownLayout.astro title: About UbuCon Asia 2024 description: Brief introduction to UbuCon Asia 2024 --- diff --git a/src/pages/index.astro b/src/pages/index.astro index 00243e7..3b08920 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,10 +1,10 @@ --- -import Shell from "../layouts/Shell.astro"; -import BlogFeed from "../components/BlogFeed.astro"; +import Shell from "@layouts/Shell.astro"; +import BlogFeed from "@components/BlogFeed.astro"; import { config } from "../config"; import { Strip, Col, Row } from "@canonical/react-components"; -import uca24logo from "./logo.svg"; -import logoPlaceHolder from "./logo_placeholder.svg"; +import uca24logo from "@assets/logo.svg"; +import logoPlaceHolder from "@assets/logo_placeholder.svg"; --- diff --git a/src/pages/venue-and-travel/accommodations.mdx b/src/pages/venue-and-travel/accommodations.mdx index c4864c9..9a089c3 100644 --- a/src/pages/venue-and-travel/accommodations.mdx +++ b/src/pages/venue-and-travel/accommodations.mdx @@ -1,5 +1,5 @@ --- -layout: ../../layouts/MarkdownLayout.astro +layout: /src/layouts/MarkdownLayout.astro title: Accommodations description: Find accomodations nearby from our curated list --- diff --git a/src/pages/venue-and-travel/explore-city.mdx b/src/pages/venue-and-travel/explore-city.mdx index 68850ef..81bac9d 100644 --- a/src/pages/venue-and-travel/explore-city.mdx +++ b/src/pages/venue-and-travel/explore-city.mdx @@ -1,5 +1,5 @@ --- -layout: ../../layouts/MarkdownLayout.astro +layout: /src/layouts/MarkdownLayout.astro title: Exploring the city description: What to do and Where to go in Jaipur? --- diff --git a/src/pages/venue-and-travel/getting-to-city.mdx b/src/pages/venue-and-travel/getting-to-city.mdx index fa0b7ba..f7d90b5 100644 --- a/src/pages/venue-and-travel/getting-to-city.mdx +++ b/src/pages/venue-and-travel/getting-to-city.mdx @@ -1,5 +1,5 @@ --- -layout: ../../layouts/MarkdownLayout.astro +layout: /src/layouts/MarkdownLayout.astro title: Getting to the city description: Things to know and prepare before travelling to Jaipur, India --- diff --git a/src/pages/venue-and-travel/travel-grant.mdx b/src/pages/venue-and-travel/travel-grant.mdx index 111ab93..5637454 100644 --- a/src/pages/venue-and-travel/travel-grant.mdx +++ b/src/pages/venue-and-travel/travel-grant.mdx @@ -1,5 +1,5 @@ --- -layout: ../../layouts/MarkdownLayout.astro +layout: /src/layouts/MarkdownLayout.astro title: Travel grant description: Details on travel grant program for those who need travel funding support --- diff --git a/src/pages/venue-and-travel/venue-and-safety.mdx b/src/pages/venue-and-travel/venue-and-safety.mdx index 271674d..71027f0 100644 --- a/src/pages/venue-and-travel/venue-and-safety.mdx +++ b/src/pages/venue-and-travel/venue-and-safety.mdx @@ -1,5 +1,5 @@ --- -layout: ../../layouts/MarkdownLayout.astro +layout: /src/layouts/MarkdownLayout.astro title: Venue & Safety description: Detailed Venue, Health & Safety information --- diff --git a/tsconfig.json b/tsconfig.json index 032ad64..61d6956 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,12 @@ "extends": "astro/tsconfigs/strict", "compilerOptions": { "jsx": "react-jsx", - "jsxImportSource": "react" + "jsxImportSource": "react", + "baseUrl": ".", + "paths": { + "@components/*": ["src/components/*"], + "@layouts/*": ["src/layouts/*"], + "@assets/*": ["src/assets/*"] + } } } \ No newline at end of file