0.2.2 • Published 2 years ago

twig-parser v0.2.2

Weekly downloads
-
License
Mozilla Public Li...
Repository
github
Last release
2 years ago

Twig Parser

This tool transforms a twig template to AST. It uses chevrotain under the hood.

How to use it

import { parse } from 'twig-parser';

const twig = `
  {% set foo = range(0, 3) %}

  {% for i in foo %}
      {{ i }},
  {% endfor %}
`

const { ast, tokens, errors } = parse(twig);

Notes

  1. Whitespace trimming is not supported
  2. The body of the verbatim tag is parsed as a regular template
0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago