Vinxi
Use Content Collections with Vinxi based frameworks
The @content-collections/vinxi
package facilitates the seamless integration of Content Collections with frameworks based on vinxi like SolidStart or TanStack Start. It includes a Vite plugin designed specifically for vinxi, preventing multiple executions of Content Collections. The plugin automatically integrates Content Collections into the build process.
Installation
Install required packages:
We have to install the following packages:
@content-collections/core
@content-collections/vinxi
npm i @content-collections/core @content-collections/vinxi -D
After installation, we have to add a path alias for the generated collections to the tsconfig.json
:
{
"compilerOptions": {
// ...
"paths": {
"~/*": ["./src/*"],
"content-collections": ["./.content-collections/generated"]
}
}
}
To enable the content collections plugin we have to add the plugin to the array of vite plugins in the (app.config.ts
):
import { defineConfig } from "@solidjs/start/config";
import contentCollections from "@content-collections/vinxi";
export default defineConfig({
vite: {
plugins: [contentCollections()],
},
});
API
The package exports a single function as the default export. The function takes a single argument, an object with the following properties:
configPath
(optional)
Specifies the path to the Content Collections configuration file. Defaults to content-collections.ts
.