From fc66c2dc96e4b2e24247bc296a5e237fb9cad2dc Mon Sep 17 00:00:00 2001 From: Justin Dennison Date: Mon, 18 Nov 2024 18:40:46 -0500 Subject: [PATCH] feature: setup aliases for components, layouts, and images --- src/components/.gitkeep | 0 src/images/.gitkeep | 0 src/pages/index.astro | 2 +- src/pages/posts/index.astro | 2 +- tsconfig.json | 8 +++++++- 5 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 src/components/.gitkeep create mode 100644 src/images/.gitkeep diff --git a/src/components/.gitkeep b/src/components/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/images/.gitkeep b/src/images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/index.astro b/src/pages/index.astro index 43da8b8..49418bf 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,5 +1,5 @@ --- -import Layout from "../layouts/Layout.astro"; +import Layout from "@layouts/Layout.astro"; const baseUrl = import.meta.env.BASE_URL; --- diff --git a/src/pages/posts/index.astro b/src/pages/posts/index.astro index af7444e..a6149de 100644 --- a/src/pages/posts/index.astro +++ b/src/pages/posts/index.astro @@ -1,5 +1,5 @@ --- -import Layout from "../../layouts/Layout.astro"; +import Layout from "@layouts/Layout.astro"; import { getCollection } from "astro:content"; const postEntries = await getCollection("posts", ({ data }) => { return import.meta.env.PROD ? data.draft !== true : true; diff --git a/tsconfig.json b/tsconfig.json index 0fc51d7..d5d15fa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,12 @@ { "extends": "astro/tsconfigs/strict", "compilerOptions": { - "strictNullChecks": true + "strictNullChecks": true, + "baseUrl": ".", + "paths": { + "@components/*": ["src/components/*"], + "@images/*": ["src/images/*"], + "@layouts/*": ["src/layouts/*"] + } } }