0.2.2 • Published 12 months ago

twig-parser v0.2.2

Weekly downloads
-
License
Mozilla Public Li...
Repository
github
Last release
12 months 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

12 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago