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

Partials vs. Layouts #56

Closed
lyzadanger opened this issue Apr 8, 2016 · 4 comments
Closed

Partials vs. Layouts #56

lyzadanger opened this issue Apr 8, 2016 · 4 comments
Assignees
Labels

Comments

@lyzadanger
Copy link
Contributor

Right now, the builder has a number of src objects that defines where and how it builds parsed data. The default src options are:

  src: {
    data    : {
      basedir: 'src/data',
      glob: 'src/data/**/*'
    },
    layouts : {
      basedir: 'src/layouts',
      glob: 'src/layouts/**/*'
    },
    pages   : {
      basedir: 'src/pages',
      glob: 'src/pages/**/*'
    },
    partials: {
      basedir: 'src/partials',
      glob: 'src/partials/**/*'
    },
    patterns: {
      basedir: 'src/patterns',
      glob: 'src/patterns/**/*.html'
    }
  }

I wanted to examine partials and layouts to determine whether they are both truly needed. The rough current semantic explanation is that partials are, well, just partials, while layouts are partials but also more layout-like and intended for use with handlebars-layouts. It's also a holdover from fabricator, and I didn't really think deeply about it.

Currently: In the prepare phase, anything matched by the partials glob is registered as a partial on the handlebars instance. Additionally, anything matching the layouts glob is also registered as a partial. Thus, they are treated the same here.

In the parse phase, however, layouts are additionally added to a layouts property on the global drizzleData object—this becomes necessary for accessing them later in the render phase for handlebars-layouts reasons. I can expand on why that is necessary if y'all are curious but will leave it out here for brevity.

All that aside, I'm wondering if having separate partials really does anything for us. In a "combined" model, all of the things would get registered as partials and all of the things would be available on the global data object. I'm not sure what to call these things if we combine them, maybe templates?

Anyway, can you think of any reason that we should keep partials separate from layouts?

/cc @tylersticka @mrgerardorodriguez @saralohr

@tylersticka
Copy link
Member

Anyway, can you think of any reason that we should keep partials separate from layouts?

No, not really. I'd be fine with this. 👍

@erikjung
Copy link
Contributor

erikjung commented Apr 8, 2016

👍

1 similar comment
@gerardo-rodriguez
Copy link
Member

👍

@lyzadanger
Copy link
Contributor Author

Fixed in #58

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

No branches or pull requests

4 participants