Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Easier inclusion of "hidden" partials? #73

Closed
tylersticka opened this issue Dec 13, 2013 · 6 comments
Closed

Easier inclusion of "hidden" partials? #73

tylersticka opened this issue Dec 13, 2013 · 6 comments
Assignees

Comments

@tylersticka
Copy link

I'm working on a project where there is a hierarchical <ul> pattern. The elements therein are pretty much identical, but their styles differ depending on their depth, and they also expand and collapse in certain cases.

Because I need to demonstrate their hierarchy, I can't just use the (awesome) listItems helper verbatim. I end up doing something kinda like this...

<ul>
  <li><!-- item --></li>
  <li>
    <!-- item -->
    <ul>
    {{# listItems.three }}
      <li><!-- item --></li>
    {{/ listItems.three }}
    </ul>
  </li>
  {{# listItems.two }}
  <li><!-- item --></li>
  {{/ listItems.two }}
</ul>

...except replace <!-- item --> with a more complex, recurring chunk of markup... definitely not DRY.

Because each item uses the same markup, my first instinct was to include it as a separate molecule pattern, but this is a bit of a unique scenario because this pattern just isn't that valuable to visualize outside of the list context.

So I prefixed its filename with an underscore and attempted to include it with the shorthand partials syntax ({{> molecules-_sidebar-item}}) but was surprised to see it didn't work.

Obviously I can use the traditional Mustache syntax and include the entire filepath, but to me it was not obvious that hiding a pattern would also prevent you from using the shorthand partial syntax.

@dmolsen
Copy link
Member

dmolsen commented Dec 14, 2013

@tylersticka -

Ugh. Hadn't considered that use-case and it's a good one. You're in luck though as I'm in the guts of that part of PL currently. I'll change it up so that an underscore hides in navigation and style guide views but is available via partial syntax. And I'll make it available at {{> molecules-sidebar-item }}. That way one could hide and unhide an item without having to change partial calls.

@dmolsen dmolsen mentioned this issue Dec 14, 2013
31 tasks
@ghost ghost assigned dmolsen Dec 14, 2013
@tylersticka
Copy link
Author

@dmolsen That sounds perfect!

@dmolsen
Copy link
Member

dmolsen commented Jan 8, 2014

@tylersticka -

This has been added in the dev branch.

@dmolsen dmolsen closed this as completed Jan 8, 2014
@tylersticka
Copy link
Author

@dmolsen Whee! 😄

@faustgertz
Copy link
Contributor

@dmolsen -
Thanks for this. I am in a situation similar to @tylersticka and am super excited to try this out in the dev branch.

@dmolsen
Copy link
Member

dmolsen commented Jan 15, 2014

@faustgertz -

hey, i forgot to follow-up to your docs email. still have to swing around to it. thanks though :) and also hope you find dev branch ok. still need to write up docs for that too ;)

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

No branches or pull requests

3 participants