Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

propertiesToHash missing from Image Service API Docs #9169

Closed
amxmln opened this issue Aug 22, 2024 · 5 comments · Fixed by #9505
Closed

propertiesToHash missing from Image Service API Docs #9169

amxmln opened this issue Aug 22, 2024 · 5 comments · Fixed by #9505
Labels
help wanted Issues looking for someone to run with them! improve documentation Enhance existing documentation (e.g. add an example, improve description)

Comments

@amxmln
Copy link
Contributor

amxmln commented Aug 22, 2024

📚 Subject area/topic

Image Service API

📋 Page(s) affected (or suggested, for new content)

https://docs.astro.build/en/reference/image-service-reference/

📋 Description of content that is out-of-date or incorrect

According to this PR, the Image Service API has a property propertiesToHash which is used to control which properties are included in the filename hash of an optimised asset.

There doesn’t seem to be a mention on the page in the docs, although I believe there should be, since it’s important information to know when creating a custom image service that supports more options than the standard one.

On a related note, I believe the built-in sharpService is not using the propertiesToHash? I couldn’t find a mention in the source code. Is that intentional and if so, why?

Edit: looking at the patch that introduced the change, it seems like if an image service doesn’t define propertiesToHash, Astro will fall back on the default ones defined in packages/astro/src/assets/consts.ts. Perhaps this could also be added to the updated documentation.

🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)

No response

@amxmln amxmln added the improve documentation Enhance existing documentation (e.g. add an example, improve description) label Aug 22, 2024
@sarah11918
Copy link
Member

Hi @amxmln , thank you for reporting this as a docs issue! I'm going to ask @Princesseuh about how best to proceed with these features, since she is the one that knows the API best.

We can work with her suggestions and would love to make sure that page is updated with all the accurate information people need!

@sarah11918 sarah11918 added the help wanted Issues looking for someone to run with them! label Sep 9, 2024
@Princesseuh
Copy link
Member

It is missing yes. I said I would add it and never did, oops.

The method optionally returns an array of strings, which represents the keys that should be included to generate the hash of the image. Its default value is everything that counts for the base services, width height format quality etc.

@sarah11918
Copy link
Member

Hi @amxmln , I'm just following up and seeing whether you are interested in making a PR to add this to the Image Services API page! If not, no worries of course. I have added the help wanted label so that anyone knows they are welcome to make a PR to add, and you have provided the link to the original PR which is already a wonderful help!

@amxmln
Copy link
Contributor Author

amxmln commented Sep 27, 2024

Hi @sarah11918, I have opened a PR for this issue. I wasn’t quite sure where to put the new content in the document, since it isn’t really a hook. So I added the information in the section about local image services.

@sarah11918
Copy link
Member

Thank you @amxmln ! I will ask @Princesseuh to review it. Really appreciate you jumping in here. 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues looking for someone to run with them! improve documentation Enhance existing documentation (e.g. add an example, improve description)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants