deno.land / x / lume@v2.1.4 / plugins / json.ts
1234567891011121314151617181920212223242526272829303132import json from "../core/loaders/json.ts";import { merge } from "../core/utils/object.ts";
import type Site from "../core/site.ts";
export interface Options { /** The list of extensions this plugin applies to */ extensions?: string[];
/** Optional sub-extension for page files */ pageSubExtension?: string;}
// Default optionsexport const defaults: Options = { extensions: [".json", ".jsonc"], pageSubExtension: ".page",};
/** A plugin to add support for JSON files */export default function (userOptions?: Options) { const options = merge(defaults, userOptions);
return (site: Site) => { site.loadData(options.extensions, json); site.loadPages(options.extensions, { pageSubExtension: options.pageSubExtension, loader: json, }); };}
Version Info