Directive preprocessor¶
Directive preprocessor lets you control process of creating directives. You can make custom attributes and make different transformations.
Objects:
- alight.directivePreprocessor - a default preprocessor, you can change it
- alight.directivePreprocessor.ext - a list of handlers, you can append/remove them
Example how to create attribute ‘bold’¶
alight.directivePreprocessor.ext.splice(1, 0, {
code: 'bold', // not necessary
fn: function() {
if(this.directive.bold) this.element.innerHTML = '<b>' + this.element.innerHTML + '</b>'
}
})
How ot use it¶
alight.directives.al.example = {
bold: true
}