gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.94k stars 7.54k forks source link

Add Resources.ByMediaType #12874

Open bep opened 1 month ago

bep commented 1 month ago

Working in improving the JS build situation, I'm ending up in a situation where I get a Resources slice that contains both Javascript and CSS.

I could filter this with where, but since this will be such a common construct, I think we need to add another By* method.

We have Resources.ByType which is (a little confusingly) filtering by the media type's main type.

I suggest we add:

Resources.ByMediaType so {{ $resources.ByMediaType "text/css" }} would return what's expected.