National Park of Minnesota

    twig-ast

    1.6.6 • Public • Published

    Twig-AST

    Parses Twig templates into an AST.

    Usage

    const TwigAST = require('twig-ast');
    const ASTUtils = require('twig-ast/dist/print');
     
    const ast = TwigAST.toAST('Hello {{planet}}');
     
    ASTUtils.print(ast);

    Returns

    Tree                                  Derived from
    -----                                 -------------
      TEXT                                "Hello {{planet}}"
      ├ LITERAL                           "Hello "
      ├ TAG_OUTPUT                        "{{planet}}"
      │ └ EXPRESSION                      "planet"
      │   └ VARIABLE (planet)             "planet"
      └ LITERAL                           ""

    Contribute

    We really appreciate any contribution you would like to make, so don't hesitate to report issues or submit pull requests.

    License

    This project is released under a MIT license.

    About us

    If you would like to know more about us, be sure to have a look at our website, or our Twitter accounts Ambassify, Sitebase, JorgenEvens

    Install

    npm i twig-ast

    DownloadsWeekly Downloads

    13

    Version

    1.6.6

    License

    MIT

    Unpacked Size

    550 kB

    Total Files

    39

    Last publish

    Collaborators

    • ambassify
    • jorgenevens
    • sitebase