Table of Contents
middleware are either user defined or third-party utilities used to supplement or override the Component API. The middleware are used for manipulating markup
and styles
of a component.
{
markup: Object,
styles: Object
}
Used to manipulate markup
.
{
parser: Function,
converter: Function,
custom: Array
}
Used to parse markup
. This will override the default markup parser for a component.
parser(markup)
markup
- Type:
string
- Required: Yes
- Usage: Contains markup to be parsed
- Type:
A promise that resolves to a Node
.
Used to convert an XML based document to HTML document. This is used when the markup used is not HTML. This overrides the default converter for a component.
converter(element)
element
- Type:
Element
- Required: Yes
- Usage: Converted to
HTMLElement
- Type:
A promise that resolves to an HTMLElement
.
Array of functions used to process markup
. The functions are invoked in the order they are in the array. The result of one function is passed to the next function. After processing, the end result is assigned to Component.scope
. This overrides all the component utilities used to process markup.
Used to manipulate styles
.
{
preprocessor: Function,
postprocessor: Function,
custom: Array,
process: Boolean,
scope: Boolean
}
Used to preprocess styles
. This can be used for languages that can be converted to CSS.
preprocessor(styles)
styles
- Type:
string
- Required: Yes
- Usage: Converted to CSS
- Type:
A promise that resolves to a string containg CSS.
Used to post-process CSS. This can be used to add vendor prefixes and the like.
postprocessor(css)
css
- Type:
String
- Required: Yes
- Usage: Converted to post-precessed CSS
- Type:
A promise that resolves to a string
containing post-processed CSS.
Array of functions used to process styles
. The functions are invoked in the order they are put in the array. The result of one function is passed to the next function. The end result is used to style the component. These utilities override all the default styling utilities of a component.
Specifies whether the styles should be processed or not. You can set this to false
if the styles are already processed. The default value is true
.
Specifies whether or not the styles should be scoped. The default value is true
.