Directive preprocessor

Directive preprocessor lets you control process of creating directives. You can make custom attributes and make different transformations.


  • alight.directivePreprocessor - a default preprocessor, you can change it
  • alight.hooks.directive - a list of handlers, you can append/remove them
Example how to create attribute ‘bold’
alight.hooks.directive.ext.splice(1, 0, {
    code: 'bold',  // not necessary
    fn: function() {
        if(this.directive.bold) this.element.innerHTML = '<b>' + this.element.innerHTML + '</b>'
How to use it = {
    bold: true
comments powered by Disqus