Optimize images with @astrojs/image
This commit is contained in:
@ -2,16 +2,15 @@ import { defineConfig } from "astro/config";
|
|||||||
import tailwind from "@astrojs/tailwind";
|
import tailwind from "@astrojs/tailwind";
|
||||||
import sitemap from "@astrojs/sitemap";
|
import sitemap from "@astrojs/sitemap";
|
||||||
|
|
||||||
|
import image from "@astrojs/image";
|
||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
// Astro uses this full URL to generate your sitemap and canonical URLs in your final build
|
// Astro uses this full URL to generate your sitemap and canonical URLs in your final build
|
||||||
site: "https://astrowind.vercel.app/",
|
site: "https://astrowind.vercel.app/",
|
||||||
integrations: [
|
integrations: [tailwind({
|
||||||
tailwind({
|
|
||||||
config: {
|
config: {
|
||||||
applyBaseStyles: false,
|
applyBaseStyles: false
|
||||||
},
|
}
|
||||||
}),
|
}), sitemap({}), image()]
|
||||||
sitemap({}),
|
|
||||||
],
|
|
||||||
});
|
});
|
819
package-lock.json
generated
819
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -10,6 +10,7 @@
|
|||||||
"preview": "astro preview"
|
"preview": "astro preview"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@astrojs/image": "^0.3.3",
|
||||||
"@astrojs/sitemap": "^1.0.0",
|
"@astrojs/sitemap": "^1.0.0",
|
||||||
"@astrojs/tailwind": "^1.0.0",
|
"@astrojs/tailwind": "^1.0.0",
|
||||||
"astro": "^1.0.0"
|
"astro": "^1.0.0"
|
||||||
|
Before Width: | Height: | Size: 620 KiB After Width: | Height: | Size: 620 KiB |
@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
const { } = Astro.props;
|
import { Picture } from '@astrojs/image/components';
|
||||||
|
const { } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
@ -30,9 +31,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="relative flex justify-center mb-8 ">
|
<div class="relative flex justify-center mb-8">
|
||||||
<div class="flex flex-col justify-center">
|
<div class="flex flex-col justify-center">
|
||||||
<img class="mx-auto rounded-md" src="/images/hero-astro.jpg" width="768" height="432" alt="Hero">
|
<Picture src={import('~/assets/hero-astro.jpg')} class="mx-auto rounded-md" widths={[400, 768]}
|
||||||
|
sizes="(max-width: 768px) 100vw, 768px" alt="Hero Image" aspectRatio="16:9" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user