#26 Wildcard resource loading

Open
opened 1 month ago by jhabdas · 0 comments
jhabdas commented 1 month ago

https://gohugo.io/news/0.57.0-relnotes/

Resources Loading from Assets with Wildcards: We have added two new sought after template functions to the resources namespace: resources.Match and resources.GetMatch. These behaves like their namesake methods on Page (with super-asterisk wildcard support), but searches in all the resources in Assets. E.g. {{ $prettyImages := resources.Match "images/**pretty.jpg" }} will give a slice of all “pretty pictures”. Another relevant example: {{ $js := resources.Match "libs/*.js" | resources.Concat "js/bundle.js" }}.

https://gohugo.io/news/0.57.0-relnotes/ > **Resources Loading from Assets with Wildcards:** We have added two new sought after template functions to the `resources` namespace: `resources.Match` and `resources.GetMatch`. These behaves like their namesake methods on Page (with [super-asterisk wildcard support](https://github.com/gobwas/glob)), but searches in all the resources in Assets. E.g. `{{ $prettyImages := resources.Match "images/**pretty.jpg" }}` will give a slice of all “pretty pictures”. Another relevant example: `{{ $js := resources.Match "libs/*.js" | resources.Concat "js/bundle.js" }}`.
jhabdas added the
enhancement
label 1 month ago
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
Cancel
Save
There is no content yet.