Skip to content

Instantly share code, notes, and snippets.

@tremby
Last active April 24, 2018 00:25
Show Gist options
  • Save tremby/62df667cf9fb9dc7a303 to your computer and use it in GitHub Desktop.
Save tremby/62df667cf9fb9dc7a303 to your computer and use it in GitHub Desktop.
Twig.js bug breaking case
test2layout.twig 1 [foo] [bar]
test2page.twig 1 [foo] []
test2.twig 1 [foo] [] [baz]
test2template.twig 1 [] [] [baz]
test2.twig 2 [] [] [baz]
test2template.twig 2 [] [] [baz]
test2.twig 3 [foo] [] [baz]
test2page.twig 2 [foo] []
test2layout.twig 2 [foo] [bar]
Twig = require './twig'
template = Twig.twig
id: 'test2template.twig'
path: 'test2template.twig'
async: false
layout = Twig.twig
id: 'test2layout.twig'
path: 'test2layout.twig'
async: false
page = Twig.twig
id: 'test2page.twig'
path: 'test2page.twig'
async: false
test2 = Twig.twig
id: 'test2.twig'
path: 'test2.twig'
async: false
console.log page.render
foo: 'foo'
{% set baz = 'baz' %}
test2.twig 1 [{{foo}}] [{{bar}}] [{{baz}}]
{% embed 'test2template.twig' %}
{% block content %}
test2.twig 2 [{{foo}}] [{{bar}}] [{{baz}}]
{% endblock %}
{% endembed %}
test2.twig 3 [{{foo}}] [{{bar}}] [{{baz}}]
{% set bar = 'bar' %}
test2layout.twig 1 [{{foo}}] [{{bar}}]
{% block layoutblock %}{% endblock %}
test2layout.twig 2 [{{foo}}] [{{bar}}]
{% extends 'test2layout.twig' %}
{% block layoutblock %}
test2page.twig 1 [{{foo}}] [{{bar}}]
{% include 'test2.twig' %}
test2page.twig 2 [{{foo}}] [{{bar}}]
{% endblock %}
test2template.twig 1 [{{foo}}] [{{bar}}] [{{baz}}]
{% block content %}{% endblock %}
test2template.twig 2 [{{foo}}] [{{bar}}] [{{baz}}]
@tremby
Copy link
Author

tremby commented Apr 24, 2018

This has been working properly in twig.js since d14a845, and the first working tag since then is v1.11.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment