Skip to content

Commit

Permalink
feat!: switch to Astro Assets
Browse files Browse the repository at this point in the history
  • Loading branch information
ElianCodes committed Aug 9, 2023
1 parent d6592c9 commit 7a5b8d4
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 67 deletions.
5 changes: 4 additions & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ import sitemap from '@astrojs/sitemap';
import UnoCSS from 'unocss/astro';

export default defineConfig({
experimental: {
assets: true,
},
// used to generate images
site:
process.env.VERCEL_ENV === 'production'
? 'https://brutal.elian.codes/'
: process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}/`
: 'https://localhost:3001/',
: 'https://localhost:3000/',
trailingSlash: 'ignore',
integrations: [sitemap(), UnoCSS({ injectReset: true })],
});
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/image": "^0.17.3",
"@astrojs/rss": "^2.4.4",
"@astrojs/sitemap": "^2.0.1",
"@eliancodes/brutal-ui": "^0.2.2",
Expand Down
43 changes: 0 additions & 43 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added src/assets/astro.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions src/components/generic/SummaryCard.astro
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
import { Card } from '@eliancodes/brutal-ui';
import { Image } from 'astro:assets';
interface Props {
title: string;
imgSrc: string;
imgAlt: string;
description: string;
}
import { Card } from '@eliancodes/brutal-ui';
const { title, imgAlt, imgSrc, description } = Astro.props;
---

<Card
color="white"
>
<Card color='white'>
<h3 class='poppins text-lg md:text-xl'>{title}</h3>
<div class='rounded-lg border-3 border-black my-4 h-56'>
<img
<Image
src={imgSrc}
alt={imgAlt}
width={800}
Expand Down
2 changes: 1 addition & 1 deletion src/content/blog/blogpost-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tags:
- JavaScript
- Astro
- UnoCSS
imgUrl: https://i.imgur.com/iGvihVf.jpg
imgUrl: '../../assets/astro.jpeg'
description: Lorem markdownum longo os thyrso telum, continet servat fetus nymphae, vox nocte sedesque, decimo. Omnia esse, quam sive; conplevit illis indestrictus admovit dedit sub quod protectus, impedit non.
layout: '../../layouts/BlogPost.astro'
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/blog/blogpost-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tags:
- Astro
- WebDev
- Programming
imgUrl: https://i.imgur.com/iGvihVf.jpg
imgUrl: '../../assets/astro.jpeg'
description: Lorem markdownum longo os thyrso telum, continet servat fetus nymphae, vox nocte sedesque, decimo. Omnia esse, quam sive; conplevit illis indestrictus admovit dedit sub quod protectus, impedit non.
layout: '../../layouts/BlogPost.astro'
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/blog/blogpost-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tags:
- CSS
- Astro
- Vite
imgUrl: https://i.imgur.com/iGvihVf.jpg
imgUrl: '../../assets/astro.jpeg'
layout: ../../layouts/BlogPost.astro
---

Expand Down
2 changes: 1 addition & 1 deletion src/content/blog/blogpost-4.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tags:
- JavaScript
- Web Development
description: Lorem markdownum longo os thyrso telum, continet servat fetus nymphae, vox nocte sedesque, decimo. Omnia esse, quam sive; conplevit illis indestrictus admovit dedit sub quod protectus, impedit non.
imgUrl: https://i.imgur.com/iGvihVf.jpg
imgUrl: '../../assets/astro.jpeg'
layout: "../../layouts/BlogPost.astro"
---

Expand Down
2 changes: 1 addition & 1 deletion src/content/blog/blogpost-5.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tags:
- JavaScript
- Theme
description: Lorem markdownum longo os thyrso telum, continet servat fetus nymphae, vox nocte sedesque, decimo. Omnia esse, quam sive; conplevit illis indestrictus admovit dedit sub quod protectus, impedit non.
imgUrl: https://i.imgur.com/iGvihVf.jpg
imgUrl: '../../assets/astro.jpeg'
layout: "../../layouts/BlogPost.astro"
---

Expand Down
2 changes: 1 addition & 1 deletion src/content/blog/blogpost-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tags:
- TypeScript
- Astro
- Web Development
imgUrl: https://i.imgur.com/iGvihVf.jpg
imgUrl: '../../assets/astro.jpeg'
layout: ../../layouts/BlogPost.astro
---

Expand Down
23 changes: 12 additions & 11 deletions src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { z, defineCollection } from "astro:content";
import { z, defineCollection } from 'astro:content';

const blogCollection = defineCollection({
schema: z.object({
title: z.string(),
author: z.string(),
tags: z.array(z.string()),
description: z.string(),
pubDate: z.string().transform((str) => new Date(str)),
imgUrl: z.string(),
draft: z.boolean().optional().default(false),
}),
schema: ({ image }) =>
z.object({
title: z.string(),
author: z.string(),
tags: z.array(z.string()),
description: z.string(),
pubDate: z.string().transform((str) => new Date(str)),
imgUrl: image(),
draft: z.boolean().optional().default(false),
}),
});

export const collections = {
blog: blogCollection,
blog: blogCollection,
};

0 comments on commit 7a5b8d4

Please sign in to comment.