Skip to content

Commit

Permalink
Adds Typescript support
Browse files Browse the repository at this point in the history
  • Loading branch information
webketje committed Nov 26, 2022
1 parent 30fc0c5 commit 3b1b438
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Plugin } from 'metalsmith';
import defaultValues from '.';

export default defaultValues;
export interface DefaultsSet {
/** 1 or more glob patterns to match files. Defaults to `'**'` (all). */
pattern?: string;
/** an object whose keys will be set as file metadata keys */
defaults: {
[key:string]: string;
}
}
export type Options = DefaultsSet|DefaultsSet[]
/**
* Set `defaults` to file metadata matching `pattern`'s.
*
* @example
* metalsmith.use(defaultValues({
pattern: 'posts/*.md',
defaults: {
layout: 'post.hbs',
draft: false,
date(post) {
return post.stats.ctime
}
}
}))
**/
declare function defaultValues(options: Options): Plugin;

0 comments on commit 3b1b438

Please sign in to comment.