Skip to content

Render snippets as component #75

@Wolfr

Description

@Wolfr

I have a question about this package.

Is it possible to also render out the snippets as the component itself instead of code? This way I can then use the same file for the "displaying" of the component as the snippet itself.

I have style guides that look like this:

image

This Panel is then placed under /snippets/panel-with-double-body.hbs. That file contains code like this:

  <Panel as |pl|>
    <pl.Header>
      <h4 class="c-panel__title">Panel header</h4>
    </pl.Header>
    <pl.Body>
      <p>Lorem ipsum dolor sit amet.... </p>
    </pl.Body>
    <pl.Body>
      <p>Lorem ipsum dolor sit amet.... </p>
    </pl.Body>
  </Panel>

I am using this package and ember codeblock to render the code:

{{#let (get-code-snippet @snippet) as |snippet|}}
  <CodeBlock
    class="br-styleguide-code-block"
    @code={{snippet.source}}
    @language="markup"
  />
{{/let}}

Now, can I also use this file to render out the visual example?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions