Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow import args! #6

Open
TorbenKoehn opened this issue Oct 6, 2015 · 2 comments
Open

Allow import args! #6

TorbenKoehn opened this issue Oct 6, 2015 · 2 comments
Milestone

Comments

@TorbenKoehn
Copy link
Member

Import's actually support Attributes right now.

extends some-file(foo='bar', 'baz')
is perfectly valid right now and the import node will get the correct attributes appended to ->attributes

The plan is to make this feature local, include-based variables

e.g.

navigation.jade

nav.nav(class='nav-'.($vertical ? 'vertical' : 'horizontal')

index.jade

include navigation(vertical=false)
@TorbenKoehn TorbenKoehn added this to the 1.6 milestone Apr 7, 2016
@YamiOdymel
Copy link

YamiOdymel commented Jun 18, 2016

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

@TorbenKoehn
Copy link
Member Author

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

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

No branches or pull requests

2 participants