Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinmcfarland committed Aug 7, 2024
1 parent d157541 commit 2c77d86
Showing 1 changed file with 54 additions and 38 deletions.
92 changes: 54 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ mole.config('src/mole.config.js')

The location of your theme data.

---

- **`model?: string | string[]`**

The value can be:
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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`
Expand All @@ -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`
Expand All @@ -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`

Expand All @@ -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
Expand Down

0 comments on commit 2c77d86

Please sign in to comment.