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

Overriding pattern HTML previews #84

Open
tylersticka opened this issue Apr 25, 2016 · 6 comments
Open

Overriding pattern HTML previews #84

tylersticka opened this issue Apr 25, 2016 · 6 comments
Milestone

Comments

@tylersticka
Copy link
Member

tylersticka commented Apr 25, 2016

This idea just came to me and it may be a terrible one.

But if our patternSource helper included some bit of data (isSource: true) or whatever, we could theoretically do this with our patterns:

<table class="Table Table--striped">
  {{#if isSource}}
    <!-- etc. -->
  {{else}}
    <tr>
      <td>Some</td>
      <td>Really</td>
      <td>Verbose</td>
      <td>Content</td>
      <td>That</td>
      <td>Seems</td>
      <td>Redundant</td>
      <td>To</td>
      <td>Show</td>
      <td>In</td>
      <td>Its</td>
      <td>Entirety</td>
    </tr>
  {{/if}}
</table>

Not high priority, just something to think about! ¯_(ツ)_/¯

@erikjung
Copy link
Contributor

@tylersticka Is the desire to be able to use customized (truncated, simplified, etc.) HTML for the code example?

@tylersticka
Copy link
Member Author

@erikjung Yes!

I imagine there are probably like fourteen ways of accomplishing that. But for some reason this idea just popped in my head and I figured I'd document it.

@erikjung
Copy link
Contributor

@tylersticka How about this approach:

# pattern.hbs
name: Neat Component
notes: ...
example: |
  <div class="NeatComponent">
  ...
  </div>

And then the helper can check for the presence of example (or whatever we call it) and use that for the output instead of the rendered file contents?

@tylersticka
Copy link
Member Author

tylersticka commented Apr 25, 2016

@erikjung I'd be fine with either direction, honestly.

I'd say I'll probably only use it maybe 5% of the time. So repeating some source in the YAML is not a concern.

@erikjung
Copy link
Contributor

@tylersticka I imagine use cases where the inner contents of the HTML are needed to present an understandable visual, but noisy to include in the code itself.

For example: http://getbootstrap.com/components/#panels-alternatives

@tylersticka
Copy link
Member Author

@erikjung Yep, that example is spot-on.

@erikjung erikjung changed the title Should patternSource helper include a boolean to tell we're in source? Overriding pattern HTML previews May 26, 2016
@erikjung erikjung modified the milestone: Future May 26, 2016
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