Open TorbenKoehn opened 9 years ago
I have a thought about this,
maybe you can backup the variables before include the template,
and restore the variables back after included the template,
for example if we are going to include a foo
template like this:
include foo(var1="val")
the compiled result might looks like this:
<?php backup(['var1' => $var1]); $var1 = "val"; ?>
<?php include 'foo'; ?>
<?php $var1 = restore('var1'); ?>
Just an idea for you to know :D
Tale Jade doesn't use include
since it would be a mess to handle. It's actually pretty easy to implement this, I just don't know if I even want/need it yet.
You basically can access any variable anyways, so
$var1 = 'val'
include foo
or even
$includeArgs(var1='val1' var2='val2')
include foo
would work just as well
Import's actually support Attributes right now.
extends some-file(foo='bar', 'baz')
is perfectly valid right now and theimport
node will get the correct attributes appended to->attributes
The plan is to make this feature local, include-based variables
e.g.
navigation.jade
index.jade