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

Relative path for partials/pattern #43

Closed
gunnx opened this issue Apr 17, 2016 · 8 comments
Closed

Relative path for partials/pattern #43

gunnx opened this issue Apr 17, 2016 · 8 comments
Labels

Comments

@gunnx
Copy link

gunnx commented Apr 17, 2016

It looks like partials is relative to root, while pattern is relative to src

@doodzik
Copy link
Contributor

doodzik commented May 8, 2016

can you provide additional informations how you set it up?
If you don't want it to be public you can email it to me.
I'm going to look into it and reopen this issue as soon as I get the information :)

@gunnx
Copy link
Author

gunnx commented May 8, 2016

Here is extract of my config:

Metalsmith(__dirname)
.use(inplace({
    engine: 'handlebars',
    partials: 'src/partial',
    pattern: 'page/*.hbs',
    rename: true
  }))

The partials is relative to the where I ran the build from while pattern is relative to the default Metalsmith folder, which is src in my case.

@ismay
Copy link
Contributor

ismay commented May 8, 2016

The partials is relative to the where I ran the build from while pattern is relative to the default Metalsmith folder, which is src in my case.

That's intentional. The reason being that you don't want your partials to end up in your dist (since they're only partials and not complete files meant for output). So we let you choose where your partials are in your project folder (which should be outside of src).

pattern is relative to src because it doesn't make sense to use a pattern outside of src, since metalsmith only processes files from src.

I understand how this can be confusing, because your approach works, as you're filtering out the partials with the pattern, but that is by no means the recommended approach. The way this is meant to be used is by putting your partials outside of src.

@ismay
Copy link
Contributor

ismay commented May 8, 2016

@doodzik Maybe we should document this more clearly in the readme. I've now come across several cases where people are putting layouts and partials in src, which in my opinion isn't something we want to support.

@gunnx
Copy link
Author

gunnx commented May 8, 2016

Thanks for the explanation, I'm used to putting all my source code under src so I include partials in there too, as you noticed I keep my pages separate from my partials.
I'd say just a bit more in the readme will do the job.

@doodzik
Copy link
Contributor

doodzik commented May 8, 2016

I think it makes sense to separate them, but we definitely want to add that to the readme.

@doodzik doodzik self-assigned this May 8, 2016
@doodzik
Copy link
Contributor

doodzik commented May 8, 2016

@ismay should we do it as a point in a faq?
which also means adding a faq.

@ismay
Copy link
Contributor

ismay commented May 9, 2016

Hmm yeah, we could also add it to the pattern and partials sections, but it might not be noticed there. A faq seems like a good idea 👍

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

3 participants