diff --git a/README.md b/README.md index b306ec1..d44f06e 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ mole.config('src/mole.config.js') The location of your theme data. +--- + - **`model?: string | string[]`** The value can be: @@ -48,6 +50,8 @@ mole.config('src/mole.config.js') When using a `dir`, it will search for files or sub-directories within that directory whose names match the specified output name. +--- + - **`template: string | string[]`** The value can be: @@ -59,47 +63,12 @@ mole.config('src/mole.config.js') A template can be a callback or a template string. +--- + - **`output: object | object[]`** An object that defines where (`file`) and how (`model`, `template`) to process the output. You can set a different `template` or `model` for each output. Name each output by using a key. -### Types - -- **`Config`** - - ```ts - type Config { - theme: string, - model?: string[], - template?: string[], - output: Output - } - ``` - -- **`Output`** - - ```ts - type Output { - name: { - file: string - model?: string[], - template?: string[] - } - } - ``` - -- **`ModelCallback`** - - ```ts - type ModelCallback = (theme: object, name: string, str: string) => object - ``` - - **`TemplateCallback`** - - ```ts - type TemplateCallback = (model: object, theme: object, name: string, str: string) => object - ``` - ## API - ### Set configuration @@ -110,6 +79,8 @@ mole.config('src/mole.config.js') - `config` { string | object } path to file, or object for config +--- + - ### Set or update theme data `mole.theme( string | object ): void` @@ -118,6 +89,8 @@ mole.config('src/mole.config.js') - `data` { string | object } path to file, or object for data +--- + - ### Register a model or template `mole.register( type, name, callback ): void` @@ -130,7 +103,9 @@ mole.config('src/mole.config.js') Register a model or template for use. -- ### Use a model or template +--- + +- ### Use a model or template that's been registered `mole.use( part ): void` @@ -141,14 +116,55 @@ mole.config('src/mole.config.js') - `name` { string } name of the template or model - `callback` { function | string } the body of the model or template +--- + - ### Render an array of templates `mole.render(): string[]` +--- + - ### Build the output files `mole.build()` +### Types + +- **`Config`** + + ```ts + type Config { + theme: string, + model?: string[], + template?: string[], + output: Output + } + ``` + +- **`Output`** + + ```ts + type Output { + name: { + file: string + model?: string[], + template?: string[] + } + } + ``` + +- **`ModelCallback`** + + ```ts + type ModelCallback = (theme: object, name: string, str: string) => object + ``` + + **`TemplateCallback`** + + ```ts + type TemplateCallback = (model: object, theme: object, name: string, str: string) => object + ``` + ## Development To create a build to distribute