HTML files should be able to reference any local assets #915
iainmerrick
started this conversation in
Proposal
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
HTML files should be able to reference any local assets, in the same way as Markdown files.
Background & Motivation
Currently, HTML files can only reference assets in the
public/
folder. This means if you have an existing HTML file referencing local assets, it can't simply be dropped into thepages/
folder as-is.This is unlike Markdown, which can reference local assets and have them automatically transformed into content-hashed URLs. HTML should behave the same way as MarkDown.
There is no existing behaviour for local asset references that people might be relying on. In cases where users do want an exact asset URL with no bundling, they can use the existing mechanism of putting their files in
public/
.This would be consistent with Astro's principles of building on web standards. Why Astro says "You can build a 'hello world' example website in Astro with just HTML and CSS". Let's expand that to "HTML, CSS and images"!
Goals
Example
Given a tag like this referencing a local image:
<img src="_foo.png">
I would expect the output to look like:
<img src="/_astro/_foo.123456.png">
Minimal example: https://stackblitz.com/edit/github-uepn1b
Related issues
Beta Was this translation helpful? Give feedback.
All reactions