velite icon indicating copy to clipboard operation
velite copied to clipboard

Feature Request: `allCollections` export

Open huntabyte opened this issue 1 year ago • 2 comments

If I want to reference all the collections, I have to import each of them like so:

import { docs, utilities, types, components } from '#content/index.js'

export const allDocs = [...docs, ...utilities, ...types, ...components]

While this works fine when I know what the various collections will be, it would be nice to be able to just import allCollections which would contain all the collections.

import { allCollections } from '#content/index.js'

(I'm building some primitive doc template utils and this would make my life much easier)

huntabyte avatar Nov 29 '24 22:11 huntabyte

I think your current solution is better, I can't find the benefit of having to built-in allCollections and it will be more complicated.

I usually suggest that we can add a layer between the application and the output of velite, adding some hydration or filtering functions required by the application

zce avatar Jan 21 '25 10:01 zce

Right, I'm doing filtering and whatnot on the application side, but I'd like to be able to do it for all collections

huntabyte avatar Jan 22 '25 21:01 huntabyte