edition-php-twig-standard icon indicating copy to clipboard operation
edition-php-twig-standard copied to clipboard

equivalent to pattern parameters in twig version?

Open simonerlandsen opened this issue 8 years ago • 2 comments

Can anyone tell me what the equivalent twig syntax/functionality would be for pattern parameters from the mustache version?

http://patternlab.io/docs/pattern-parameters.html

I have been doing a little bit of digging in the twig docs, but for now can't seem to find the a good way to pass variables from say a molecule to a referenced atom.

simonerlandsen avatar Sep 29 '16 12:09 simonerlandsen

Update: found the (quite obvious) place in the twig docs: http://twig.sensiolabs.org/doc/tags/include.html

simonerlandsen avatar Sep 29 '16 12:09 simonerlandsen

@simonerlandsen This isn't working for me. Did you get it working?

My code:

{# primary-nav.twig #}

{% set nav_class = "navbar-nav" %}
...
  <ul class="{{ nav_class }}">
{#  header.twig #}

{% include "molecules-primary-nav" with { 'nav_class': 'navbar' } %}

The value of nav_class in header.twig after compiling is still "navbar-nav".

KatieMFritz avatar Sep 15 '17 20:09 KatieMFritz