metalsmith / layouts

A metalsmith plugin for layouts
MIT License
116 stars 49 forks source link

Added partialExtension property to filter patterns by extension before passing to templating engine #116

Closed micahgodbolt closed 7 years ago

micahgodbolt commented 7 years ago

Updating a test to demonstrate error mention in #111

micahgodbolt commented 7 years ago

This addresses #111

ismay commented 7 years ago

Looks good, I'll take a better look asap and see if we can merge this. Thanks for the pr!

micahgodbolt commented 7 years ago

@ismay thanks! I'm open to changing the param name if you prefer. Also I'm making the assumption that pattern and partialExtension are 2 different things (one is about src files, the other about partial template files.

Also, I went with strict extension matching vs the more complex match() that you use in pattern (which takes */.html). I don't see an instance where we need to make sure partials match full pattern as we'll be explicitly calling the partial path on include.

ismay commented 7 years ago

I'm open to changing the param name if you prefer

I think it's fine, partialExtension is a nice descriptive name.

Also I'm making the assumption that pattern and partialExtension are 2 different things (one is about src files, the other about partial template files.

Yeah I think that's the best solution. Making partialExtension accept a glob would only make it confusing in my opinion.

I don't see an instance where we need to make sure partials match full pattern as we'll be explicitly calling the partial path on include.

Yeah exactly.

ismay commented 7 years ago

Released as 1.8.0

doublejosh commented 6 years ago

Discovered that similarly, if you rename any layouts to .hbs ...it will then decide to look for your partials with .hbs extensions rather than .html ...so you're stuck leaving page layouts as .html.

I'm using version 1.8.1