Skip to content

Add assets page#2779

Merged
sarah11918 merged 57 commits intomainfrom
feat/assets
Mar 7, 2023
Merged

Add assets page#2779
sarah11918 merged 57 commits intomainfrom
feat/assets

Conversation

@natemoo-re
Copy link
Copy Markdown
Member

@natemoo-re natemoo-re commented Mar 2, 2023

What kind of changes does this PR include?

  • New or updated content

Description

Open Questions

  • How much do we want to integrate this into the Images guide? Is the top-level warning and pointing to the other page sufficient?

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 2, 2023

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 3b6cc8c
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/6407883dac0a2d0008ed5fa9
😎 Deploy Preview https://deploy-preview-2779--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@Jutanium
Copy link
Copy Markdown
Contributor

Jutanium commented Mar 2, 2023

Awesome! I noticed there's no examples here about what changes with images in Markdown - I know you can now use relative images, does anything else change?

@natemoo-re natemoo-re marked this pull request as ready for review March 3, 2023 17:20
Copy link
Copy Markdown
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving these to make link checker happy!

@sarah11918 sarah11918 added add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) labels Mar 3, 2023

### `getImage()` (`astro:assets`)

This function is intended for generating images destined to be used somewhere else than directly in HTML, for example in CSS or in an [API Route](/en/core-concepts/endpoints/#server-endpoints-api-routes).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A major usage of getImage is also if you want to create your own Image component, might be worth a shoutout (the included Image component is basically just a call to getImage!)


### Update your Markdown files

Relative images can now be referenced in Markdown and MDX files. These will automatically be optimized and hashed by Astro's build process.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Relative images can now be referenced in Markdown and MDX files. These will automatically be optimized and hashed by Astro's build process.
Relative images can now be referenced in Markdown. These will automatically be optimized and hashed by Astro's build process.


#### How this Works

At build time for static sites, both `<Image/>` and `getImage(options)` call the `transform()` function. They pass options either through component attributes or an `options` argument, respectively. The transformed images will be built to a `dist/_astro` folder.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also the case for pre-rendered routes, if you want to add an additional precision.

sarah11918 and others added 12 commits March 7, 2023 12:34
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
@sarah11918 sarah11918 merged commit e1a3bd1 into main Mar 7, 2023
@sarah11918 sarah11918 deleted the feat/assets branch March 7, 2023 20:01
@sarah11918 sarah11918 added the minor-release For the next minor release; in the milestone, "merge queue" = approved for merging on release day. label Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) minor-release For the next minor release; in the milestone, "merge queue" = approved for merging on release day.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants