Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "compile-string"

Index

Functions

compileScope

  • Loops through the AST generated by parse and transform each item into JS calls

    Example

    // AST version of 'Hi <%= it.user %>'
    let templateAST = ['Hi ', { val: 'it.user', t: 'i' }]
    compileScope(templateAST, eta.config)
    // "tR+='Hi ';tR+=E.e(it.user);"

    Parameters

    Returns string

compileToString

  • compileToString(str: string, config: EtaConfig): string
  • Compiles a template string to a function string. Most often users just use compile(), which calls compileToString and creates a new function using the result

    Example

    compileToString("Hi <%= it.user %>", eta.config)
    // "var tR='',include=E.include.bind(E),includeFile=E.includeFile.bind(E);tR+='Hi ';tR+=E.e(it.user);if(cb){cb(null,tR)} return tR"

    Parameters

    Returns string

Generated using TypeDoc