Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Add nunjucks spread params filter#69

Merged
timarney merged 2 commits intomasterfrom
filter
Sep 26, 2019
Merged

Add nunjucks spread params filter#69
timarney merged 2 commits intomasterfrom
filter

Conversation

@timarney
Copy link
Copy Markdown
Member

@timarney timarney commented Sep 25, 2019

Added a filter to open up the possibility of using arbitrary params.

We could filter out to use only data- params for safety.

See this link for output https://cds-node-starter-pr-69.herokuapp.com/start

Will remove the sampleInput later

 {{ sampleInput({"class": "error", "data-arr1":"data-1","data-arr2":"data-2"}) }}
{% macro sampleInput(obj) %}
    <div {{""|spreadParams(obj) }}>
        your text
    </div>
{% endmacro %}

Outputs

<div class="error" data-arr1="data-1" data-arr2="data-2">
  your text
</div>

@timarney timarney merged commit 71dbde6 into master Sep 26, 2019
@timarney timarney deleted the filter branch September 26, 2019 15:04
@timarney timarney mentioned this pull request Nov 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants