.renameTemplate - PeterNaydenov/code-assembly-line GitHub Wiki

Change name of template/templates.

tplEngine.renameTemplate ( {oldName : newName} )

  • oldName: string. Name of existing template;
  • newName: string. Desired new template name;
  • Method return options:
    • tplEngine;
  • Method is chainable;

Example:

  const templates = {
                        'age' : '{{user}} is {{age}} years old.'    // template 'age'
                    }

 tplEngine.insertTemplate ( templates )
 // Now templates are available in template engine



 tplEngine.renameTemplate ( { 'age' : 'userAge' } )
 // ->  will create new property 'userAge' that will get template from 'age'. Property 'age' will be deleted.