Skip to content

Latest commit

 

History

History
128 lines (103 loc) · 3.71 KB

API.md

File metadata and controls

128 lines (103 loc) · 3.71 KB

Functions

File()

Component is used to describe to the generator that you want a file to be created and rendered based on the defined children.

Indent()

Component is for wrapping multiple components and apply an indentation on those.

It supports any form of nested components as well, meaning you can have as many nested Indent components as you would like.

Text()

Component is for defining a group of text which should be rendered on the same line.

render(component)string

Renders given component to string

renderTemplate(filepath)

render a file with react. This function automatically transforms jsx to js before importing the component.

transpileFiles(directory, outputDir, options)

Transpile files in a given directory (and sub directory if recursive option are passed) and write it to an output directory, if no errors are thrown it completed successfully.

IndentationTypes : enum

Type of indentation to use

Kind: global enum
Read only: true
Properties

Name Type Description
TABS string indicate to use tabs as separator
SPACES string indicate to use spaces as separator

File()

Component is used to describe to the generator that you want a file to be created and rendered based on the defined children.

Kind: global function
Component:
Example

const name = "test.js"
const permissions = 0o777
return (
  <File name={name} permissions={permissions}>Test</File>
)

Indent()

Component is for wrapping multiple components and apply an indentation on those.

It supports any form of nested components as well, meaning you can have as many nested Indent components as you would like.

Kind: global function
Component:
Example

const size = 4
const type = IndentationTypes.SPACES
return (
  <Indent size={size} type={type}>test</Indent>
)

Text()

Component is for defining a group of text which should be rendered on the same line.

Kind: global function
Component:
Example

const indent = 4
const type = IndentationTypes.SPACES
const newLines = 2
return (
  <Text indent={size} type={type} newLines={newLines}>Test</Text>
)

render(component) ⇒ string

Renders given component to string

Kind: global function

Param Type Description
component ReactNode a given component to rendering

Example

function Component({ textProp }) {
  return <>{textProp}</>
}
render(<Component textProp="someText" />)

renderTemplate(filepath)

render a file with react. This function automatically transforms jsx to js before importing the component.

Kind: global function

Param Description
filepath the path to file to render

transpileFiles(directory, outputDir, options)

Transpile files in a given directory (and sub directory if recursive option are passed) and write it to an output directory, if no errors are thrown it completed successfully.

Kind: global function

Param Description
directory to transpile.
outputDir to write the transpiled files to.
options any extra options that should be passed.