Skip to content
This repository was archived by the owner on Sep 24, 2021. It is now read-only.
Jamen Marz edited this page Jan 26, 2016 · 6 revisions

Classes

Token

Base token, every token extends this one.

GroupToken

A grouping token for lists, blocks, expressions, etc.

BlockGroup

A shorthand way to create blocks.

SelectorToken

A token to express selectors.

PropertyToken

A token to express properties.

ValueToken

A token to express values.

Functions

parse(input)Tree

Parse a text or buffer into a token tree.

Token

Base token, every token extends this one.

Kind: global class

new Token(value, children, meta)

Param Type Default Description
value Object {} Values of the token.
children Array [ Children tokens.
meta Object {} Metadata options.

token.appendChild(item)

Append a new child token and redelegate.

Kind: instance method of Token

Param Type Description
item Token Token to add.

token.render() ⇒ String

Turn the token into a CSS-formatted string.

Kind: instance method of Token
Returns: String - Token rendered into a string.

Group ⇐ Token

A grouping token for lists, blocks, expressions, etc.

Kind: global class
Extends: Token

new Group(value, children, meta)

Param Type Default Description
value Object {} Values of the token.
children Array [ Children tokens.
meta Object {} Metadata options.
meta.sep String '' Seperator for children.
meta.start String '{' Starting content for group.
meta.end String '}' Ending content for group.

group.appendChild(item)

Append a new child token and redelegate.

Kind: instance method of Group

Param Type Description
item Token Token to add.

group.render() ⇒ String

Turn the token into a CSS-formatted string.

Kind: instance method of Group
Overrides: render
Returns: String - Token rendered into a string.

Block ⇐ Group

A shorthand way to create blocks.

Kind: global class
Extends: Group

new Block(children, meta)

Param Type Default Description
children Array [ Children tokens.
meta Object {} Metadata options.

block.appendChild(item)

Append a new child token and redelegate.

Kind: instance method of Block

Param Type Description
item Token Token to add.

block.render() ⇒ String

Turn the token into a CSS-formatted string.

Kind: instance method of Block
Returns: String - Token rendered into a string.

Selector ⇐ Token

A token to express selectors.

Kind: global class
Extends: Token

new Selector(value, meta)

Param Type Default Description
value Object {} Values of the token.
meta Object {} Metadata options.

selector.appendChild(item)

Append a new child token and redelegate.

Kind: instance method of Selector

Param Type Description
item Token Token to add.

selector.render() ⇒ String

Turn the token into a CSS-formatted string.

Kind: instance method of Selector
Overrides: render
Returns: String - Token rendered into a string.

Property ⇐ Token

A token to express properties.

Kind: global class
Extends: Token

new Property(value, children, meta)

Param Type Default Description
value Object {} Values of the token.
children Array [ Children tokens.
meta Object {} Metadata options.

property.appendChild(item)

Append a new child token and redelegate.

Kind: instance method of Property

Param Type Description
item Token Token to add.

property.render() ⇒ String

Turn the token into a CSS-formatted string.

Kind: instance method of Property
Overrides: render
Returns: String - Token rendered into a string.

Value ⇐ Token

A token to express values.

Kind: global class
Extends: Token

new Value(value, meta)

Param Type Default Description
value Object {} Values of the token.
meta Object {} Metadata options.

value.appendChild(item)

Append a new child token and redelegate.

Kind: instance method of Value

Param Type Description
item Token Token to add.

value.render() ⇒ String

Turn the token into a CSS-formatted string.

Kind: instance method of Value
Overrides: render
Returns: String - Token rendered into a string.

parse(input) ⇒ Tree

Parse a text or buffer into a token tree.

Kind: global function
Returns: Tree - Token tree of the input.

Param Type Description
input String | Buffer | Array Source to parse.