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

Add .Resource.PathInfo #12143

Open
bep opened this issue Feb 24, 2024 · 1 comment
Open

Add .Resource.PathInfo #12143

bep opened this issue Feb 24, 2024 · 1 comment
Labels
Milestone

Comments

@bep
Copy link
Member

bep commented Feb 24, 2024

Which would be a smaller and curated version of what we assign to every resource internally. Instead of adding lots of NameOriginal variants, you would be able to do:

.PathInfo.Name // => roses-are-red.en.jpg
.PathInfo.NameNoIdentifier // => roses-are-red
.PathInfo.Unnormalized.NameNoIdentifier // => Roses are red
.PathInfo.Path

I can outline such an interface if people think it's a good idea ...?

/cc @jmooring

@bep bep changed the title Add Path to the Resource interface Add .Resource.PathInfo Feb 24, 2024
@bep bep added Proposal and removed Enhancement labels Feb 24, 2024
@akbyrd
Copy link

akbyrd commented Mar 17, 2024

Based on the context here I would personally find value in being able to get the extension of a resource without causing it to be published (e.g. because I'm going to rename it).

How would this interact with files that are compiled and have their extension change?

Given

{{ with resources.Get "main.ts" }}
    {{ $resource := . | js.Build }}
{{ end }}

Would $resource.PathInfo.Name be main.ts or main.js?

@bep bep added this to the v0.131.0 milestone Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants