Mole

Mole

Create a new instance of the main application

import * from 'mole'

mole.add(
	new Model('model-name', ({data}) => {
		data.hello = "hello"
		return data
	})
)

mole.build()

Constructor

new Mole()

Source:

Classes

Config
Data
Output
Peripherals
Theme

Methods

add(peripheral) → {Mole#peripherals}

Adds a new model or template to list of peripherals

Source:
Parameters:
Name Type Description
peripheral Mole.Model | Mole.Template

Either an instance of a Model or a Template

Returns:
Type:
Mole#peripherals
Example
// Adding a template dynamically to a named output of `css`
mole.add(
	new Template('template-name', ({data, theme}) => {
		return '// return string'
	}
)

build() → {Mole#outputs}

Builds the files from the outputs

Source:
Tutorials:
  • Tutorial: Outputting build files
Parameters:
Type Description
Object
Returns:
Type:
Mole#outputs
Example
// Example output
build/
	css/
		styles.css
	ios/
		styles.h
	android/
		styles.xml

render(outputs) → {Mole#files}

Renders the templates and models of the outputs

Source:
Parameters:
Name Type Description
outputs Object

Outputs with string and data to render

Returns:
Type:
Mole#files

Returns an array of objects with contents and paths