simon-dt / gulp-twig

Twig plugin for gulp.js, The streaming build system. Looking for maintainer or collaborators. See wiki
https://github.com/zimmen/gulp-twig/wiki/Looking-for-maintainer-or-collaborator(s)
MIT License
62 stars 33 forks source link

include .html with variables go wrong #61

Open 1aron opened 5 years ago

1aron commented 5 years ago

index.html

<div class="x-4 h-full">
    {% include '../shared/_picker.html' with {start: 0, end: 9} %}
</div>

shared/_picker.html

{% for index in start..end %}
    <a class="picker-item f-orange">{{ index }}</a>
{% endfor %}

Above, It compile correctly but output the following errors. My test results tell me that because the parameter of the{% for %} tag is the incoming dynamic variable (with), this error is caused.

TypeError: low.charCodeAt is not a function
    at Object.range (/usr/local/lib/node_modules/@master/cli/node_modules/twig/twig.js:4334:30)
    at Object.Twig.expression.operator.parse (/usr/local/lib/node_modules/@master/cli/node_modules/twig/twig.js:3506:44)
    at Twig.Template.parse (/usr/local/lib/node_modules/@master/cli/node_modules/twig/twig.js:2134:46)
    at expressionToken (/usr/local/lib/node_modules/@master/cli/node_modules/twig/twig.js:3117:51)
    at next (/usr/local/lib/node_modules/@master/cli/node_modules/twig/twig.js:7996:24)
    at Object.forEachAsync [as forEach] (/usr/local/lib/node_modules/@master/cli/node_modules/twig/twig.js:8007:16)
    at Twig.Template.<anonymous> (/usr/local/lib/node_modules/@master/cli/node_modules/twig/twig.js:3099:31)
    at Object.potentiallyAsync (/usr/local/lib/node_modules/@master/cli/node_modules/twig/twig.js:7743:48)
    at Twig.Template.Twig.expression.parse (/usr/local/lib/node_modules/@master/cli/node_modules/twig/twig.js:3098:27)
    at Twig.Template.Twig.expression.parseAsync (/usr/local/lib/node_modules/@master/cli/node_modules/twig/twig.js:7690:38)

However, if I change the _picker.html extension to _picker.twig It will work, but I don't want my team to use it.