question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

include parameters supported?

See original GitHub issue

i’m considering a switch from swig to nunjucks and have been reading if all my requirements are covered. one thing though, can i use parameters with include?

like with swig i can use this;

    {% set parameters = {'contentType': 'tournament'} %}
    {% include "../common/editor/content.htm" with parameters only %}

and then in content.htm can reference it

{{ contentType }}

is this possible with nujucks as the documentation doesn’t mention about it? http://mozilla.github.io/nunjucks/templating.html#include

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:8
  • Comments:24 (8 by maintainers)

github_iconTop GitHub Comments

29reactions
alexflugercommented, Aug 24, 2015

This feature will be very helpful for rendering similar information from different datasources. For example we may have a template to render a list of articles:

{% for article in articles %}
    <h1>{{article.title}}</h1>
    <p>{{article.short_text}}</p>
{% endfor %}

and then use this as include for following:

<h1>Latest articles:</h1>
{% include 'articles_list' with {articles: latest_articles} %}
<h1>Popular articles:</h1>
{% include 'articles_list' with {articles: popular_articles} %}
11reactions
slavafomincommented, Aug 25, 2016

Plus one for with properties statement. It will really help to migrate from Twig.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use parameters to ask for input when running a query
Parameter A parameter is a piece of information you supply to a query right as you run it. Parameters can be used by...
Read more >
Parameters - AWS CloudFormation
Supported AWS-specific parameter types. AWS CloudFormation supports the following AWS-specific types: AWS::EC2::AvailabilityZone::Name. An Availability ...
Read more >
Parameters | Query and analyze data - Mode Support
Use parameters to make reports more scalable, re-usable and interactive by allowing viewers to modify the data returned by a report without modifying...
Read more >
Add parameters - Android Developers
Parameters are the changeable aspects of a UI Package. The Relay workflow supports two types of parameters: content parameters and interaction ...
Read more >
4 Adding Parameters and Lists of Values
Adding parameters to a data model enables users to interact with data when they view reports. Oracle BI Publisher supports the following parameter...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found