Its-Just-Nans / plugin-astro-content

plugin-astro-content

Home Page:https://its-just-nans.github.io/plugin-astro-content/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

plugin-astro-content

Glob import in astrojs ! See demo https://its-just-nans.github.io/plugin-astro-content/

Usage

Add to your astro.config.mjs:

import Content from "plugin-astro-content";

export default defineConfig({
    vite: {
        plugins: [
            Content({ objectMode: true }) // change options here
        ],
    },
});
---
import { ContentLoader, ContentLoaderRuntime } from "plugin-astro-content";

const ContentLoaderValue = ContentLoader("../*");

const dynamic = "../*";

const ContentLoaderRuntimeValue = await ContentLoaderRuntime(dynamic);

const ContentLoaderRuntimeValueWithOptions = await ContentLoaderRuntime(dynamic, { objectMode: true }); // dynamic options at runtime
---

<div>{ContentLoaderValue}</div>
<div>{ContentLoaderRuntimeValue}</div>
<div>{ContentLoaderRuntimeValueWithOptions}</div>

License

Licensed under the MIT License - LICENSE

About

plugin-astro-content

https://its-just-nans.github.io/plugin-astro-content/

License:MIT License


Languages

Language:JavaScript 100.0%