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

Document ?url usage in Imports docs #8417

Closed
tomasklaen opened this issue Jun 1, 2024 · 3 comments · Fixed by #9711
Closed

Document ?url usage in Imports docs #8417

tomasklaen opened this issue Jun 1, 2024 · 3 comments · Fixed by #9711
Labels
good first issue Good for newcomers help wanted Issues looking for someone to run with them! improve documentation Enhance existing documentation (e.g. add an example, improve description)

Comments

@tomasklaen
Copy link

tomasklaen commented Jun 1, 2024

📋 Explain your issue

The Imports documentation page is missing info on appending ?url (and other vite import parameters) to import paths to get URLs to arbitrary files for people that need to import anything else that isn't an image.

@OliverSpeir
Copy link
Contributor

?raw also might be worth mentioning

https://v3.vitejs.dev/guide/assets.html

@sarah11918 sarah11918 added improve documentation Enhance existing documentation (e.g. add an example, improve description) good first issue Good for newcomers help wanted Issues looking for someone to run with them! labels Jun 15, 2024
@sarah11918
Copy link
Member

We do have this information specifically for CSS imports, but I don't see it mentioned for other file imports.

At a minimum, the CSS imports section of the imports page could be improved with a link to that "Advanced" section on the CSS page.

And yes, it does seem like having something about the import parameters as they apply to other files would be a good addition here! I think in the "Other Assets" section makes sense? Would be happy to have someone make a PR with an addition using content from the Vite link Oliver dropped! (But not quite as long as that -- closer in length/scope to what we have on the CSS page)

@sarah11918
Copy link
Member

OK, here's my suggestion for updates to the Imports page:

  1. The CSS imports section of the imports page gets a <ReadMore> component with a link to the advanced styling section:
<ReadMore>Read more about advanced CSS import use cases such as a direct URL reference for a CSS file, or importing CSS as a string in the [Styling guide](https://docs.astro.build/en/guides/styling/#advanced)</ReadMore>`
  1. The Other Assets section of the imports page gets a link to Vite:
<ReadMore>Read about import use cases appending Vite import paramaters (e.g. `?url`, `?raw`) in [Vite's static asset handling guide](https://v3.vitejs.dev/guide/assets.html)</ReadMore>`

Note: you might have to import the ReadMore component at the top of the page, since I'm not sure it's used anywhere here!

Would gladly accept a PR with these additions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers 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