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 might not be e.g. *.html but *.html.hbs #46

Closed
devinus opened this issue Sep 4, 2015 · 8 comments
Closed

Partials might not be e.g. *.html but *.html.hbs #46

devinus opened this issue Sep 4, 2015 · 8 comments

Comments

@devinus
Copy link

devinus commented Sep 4, 2015

https://github.com/superwolff/metalsmith-layouts/blob/master/lib/helpers/read-partials.js#L34

This assumes a single extension, but a partial might need to be e.g. nav.html.hbs

@ismay
Copy link
Member

ismay commented Sep 4, 2015

That's true. But it doesn't really matter how much extensions you have, it'll just remove the last one (if there are any) for simpler partial names. So your partial name will just be nav.html.

I'll close this since this is intended behaviour, but let me know if you have further questions!

@ismay ismay closed this as completed Sep 4, 2015
@devinus
Copy link
Author

devinus commented Sep 4, 2015

@ismay Unfortunately templating engines such as e.g. Handlebars don't support . in partial names.

@devinus
Copy link
Author

devinus commented Sep 4, 2015

Perhaps a partialExtension option could be supported?

@ismay
Copy link
Member

ismay commented Sep 4, 2015

Yeah that's true. A partialExtension option would be a good idea. And when no partialExtension option's passed it won't remove anything from the partial's name. Do you have time to submit a PR?

@ismay
Copy link
Member

ismay commented Jan 31, 2016

@devinus Btw., could you elaborate on why you'd want to use multiple extensions? I don't see a reason for using .html.hbs instead of .hbs.

@ismay
Copy link
Member

ismay commented Feb 4, 2016

See metalsmith/in-place#33. Multiple extensions for templates seems to be a rails practice. There's no need for multiple extensions with this tool, and not removing all parts of the name following a dot would also prevent problems for files with multiple dots in their name.

Feel free to reopen if there is a valid need for files with multiple extensions that I've overlooked.

@ismay ismay closed this as completed Feb 4, 2016
@devinus
Copy link
Author

devinus commented Feb 4, 2016

What is a *.hbs file? Is it Handlebars wrapping plain text? XML? The reason people use e.g. *.html.hbs is so that asset pipelines and code editors know what the resulting file extension should be (just chop off the hbs extension).

For example, my code editor doesn't even know what the minor mode is unless you use a subextension.

@ismay
Copy link
Member

ismay commented Feb 4, 2016

The double extension is a rails convention. There's no need for it with metalsmith as metalsmith doesn't rename or process based on the the last extension, and I don't know of any metalsmith plugins that do.

The editors that I know treat .hbs as an html file with handlebars syntax and correctly highlight both.

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

No branches or pull requests

2 participants