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

Bug: Component preview layout only renders if not in the compound component folder #3

Closed
paulrobertlloyd opened this issue Feb 19, 2016 · 3 comments

Comments

@paulrobertlloyd
Copy link
Contributor

Given a component (hr.hbs):

<hr>

with the following config (hr.config.yml):

label: "Horizontal rule"
notes: |
  The `hr` element represents a paragraph-level thematic break, e.g., a scene change in a story, or a transition to another topic within a section of a reference book.
preview: "@preview"

and the following preview layout (_preview.hbs):

<p></p>

{{{yeild}}}

<p></p>

A component is only rendered if the preview layout is in a folder above the compound folder. So this:

├── components
│   └── hr
│   │   ├── _preview.hbs
│   │   ├── hr.config.yml
│   │   ├── hr.hbs

doesn’t work, but this:

├── components
│   ├── _preview.hbs
│   └── hr
│   │   ├── hr.config.yml
│   │   ├── hr.hbs

does. Is this the expected behaviour?

@paulrobertlloyd paulrobertlloyd changed the title Bug: Components preview layouts only render if not in compound component folder Bug: Component preview layout only renders if not in the compound component folder Feb 19, 2016
@allmarkedup
Copy link
Member

This is actually expected behaviour - a component folder (one in which the name of the folder matches the name of the component view template) can't contain other components, which the preview layout is. regular folders (collections) can contain multiple components however. Should add something to the docs about this though maybe.

Does that make sense? Is the difference between a 'collection' and a component in a directory clear?

@paulrobertlloyd
Copy link
Contributor Author

Ah right, it does makes sense. I may be trying to be too precise, but if I wanted to have a specific preview for each (or many) components, I would end up with a lot of preview layouts (somewhere). Not a big issue, but worth pointing out.

@allmarkedup
Copy link
Member

Yeah I can see that. I guess I just didn't think of preview layouts as much more than just adding stylesheet and JS links so didn't imagine needing more than a couple. I could maybe make it so that if you have a preview.hbs or similarly named layout in the same directory as your component then it's uses that for the preview layout by default.

I'll have a think if that has any other implications...

@allmarkedup allmarkedup self-assigned this Mar 5, 2016
mihkeleidast pushed a commit that referenced this issue May 15, 2020
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.4 to 4.17.13.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.4...4.17.13)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
mihkeleidast pushed a commit that referenced this issue May 21, 2020
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.4 to 4.17.13.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.4...4.17.13)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
mihkeleidast pushed a commit that referenced this issue May 23, 2020
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.4 to 4.17.13.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.4...4.17.13)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
mihkeleidast pushed a commit that referenced this issue May 23, 2020
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.4 to 4.17.13.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.4...4.17.13)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This issue was closed.
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