Collocated assets with author-controlled URL, aka content bundles #11
innermatrix
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
-
This discussion is a reboot of the RFC issue 1618.
I am writing it from scratch, because I think I can word it better now.
What I want to accomplish
Note that
What this is about is that
Also worth noting is that this is a common feature in other competing products (for example, Hugo package bundles).
Why can't I do this today
When I tried to do this in 0.20.x, I ran into several problems
src/pages
, I got compiler errorspublic
, but that doesn't meet my requirement [Roadmap] Astro v1.0 #1src/elsewhere
, but that doesn't meet either of my requirementsI do not believe this situation is changed in 0.21.
What I would like to do about this
I like the current mechanism of
import
ing an asset from a page to indicate to the compiler that the asset should be compiled into the output. I would like to meet my needs by making two changes to this mechanism:import
ed asset to reside insrc/pages
without causing compiler errors andimport
of an asset to indicate that the asset should be relocated to/path/to/asset/
rather than/_astro/path/to/asset
. I see at least two ways of doing thisOption a
Use
import assetRef from "asset";
as today, but assume that any asset insrc/pages
should be relocated to/path
rather than/_astro/path
. This is probably the easiest, but also most likely to cause the opposite problem for someone who likes the current behavior and would have to move the assets out ofsrc/pages
to get it back.Option b
Extend
import assetRef from "asset";
so that it can be used either asassetRef.private
(which would give the current behavior of relocating to/_astro/path
) or asassetRef.public
(which would give the next behavior of relocating to/path
).(Optionally allow use of bare
assetRef
to behave likeassetRef.private
to maintain backwards compatibility.)My understanding from the conversations thus far (in issue thread and in weekly RFC review) is that there is broad consensus among core devs that this is a valuable feature, but I did not previously make a concrete proposal, and as such no concrete discussion took place. I am hoping that this rewrite will change that situation.
If this discussion leads to a broad agreement that this feature is desirable and that the proposed approach is viable (or yields a different viable approach), I will write up and submit an RFC.
Beta Was this translation helpful? Give feedback.
All reactions