plugin-astro-content

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i plugin-astro-content

Weekly Downloads

7

Version

1.0.0

License

MIT

Unpacked Size

4.31 kB

Total Files

4

Last publish

Collaborators

  • n4n5