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

ignore when copying #1396

Closed
tcurdt opened this issue Sep 5, 2020 · 10 comments
Closed

ignore when copying #1396

tcurdt opened this issue Sep 5, 2020 · 10 comments

Comments

@tcurdt
Copy link

tcurdt commented Sep 5, 2020

I have some files _*.html that I do not want to get copied over.
Unfortunately it's not easy to exclude them when using globbing.

config.addPassthroughCopy("src/**/*.html");

I tried adding

**/_*.html

to .eleventyignore but that does not work either.

Is the latter a bug?

@tcurdt
Copy link
Author

tcurdt commented Sep 6, 2020

This seems to be related: #1134

@binyamin
Copy link
Member

binyamin commented Sep 6, 2020

@tcurdt Do you mind spinning up an example repo? I tried it on github (and you can run it online on gitpod), but couldn't reproduce your issue.

@tcurdt
Copy link
Author

tcurdt commented Sep 6, 2020

Interesting. Then I will prepare something. Odd. Thanks for trying!

@tcurdt
Copy link
Author

tcurdt commented Sep 6, 2020

Had to give gitpod a try https://gitpod.io/#snapshot/df8f16f3-8ace-4d0c-b151-64e603553012 :) but also exported a tgz.

11ty-Test-Tube.tar.gz

@binyamin
Copy link
Member

binyamin commented Sep 6, 2020

Thanks. Now that I see the setup, I'm not really sure why you're using passthrough file copy. 11ty considers .html a valid template extension, so I can't think what adding it to the config will do.

@tcurdt
Copy link
Author

tcurdt commented Sep 6, 2020

@binyamin Maybe I am just misunderstanding the point of a passthrough copy? But my config looks like this

for (const ext of [
  'html',
  'css',
  'jpg',
  'png',
  'gif',
  'svg',
  'java',
  'sh',
]) {
  config.addPassthroughCopy("src/**/*." + ext);
}

return {
  dir: {
    input: 'src',
    output: 'site',
  },
  templateFormats: [
    'njk',
    'md',
  ],
  htmlTemplateEngine: 'njk',
  markdownTemplateEngine : "njk",
  passthroughFileCopy: true,
}

I guess this may be a problem for other extensions nevertheless.

@binyamin
Copy link
Member

binyamin commented Sep 6, 2020

I still don't understand what you're accomplishing by config.addPassthroughCopy("src/**/*.html");.

Also, would it work to modify the glob "src/**/*.html" so that it negates any file starting with an underscore? (Something like src/**/!(_*).html)

@tcurdt
Copy link
Author

tcurdt commented Sep 6, 2020

@binyamin I don't see why I would not have to copy html files if my templates are only md and njk. Can you elaborate?

Negating the glob would of course work, too. I wasn't aware that's an option.
I'd only know how to do this with a regular expression.

I guess I can close this issue as duplicate of it #1134 which I do think is worth fixing.

@binyamin
Copy link
Member

binyamin commented Sep 6, 2020

I don't see why I would not have to copy html files if my templates are only md and njk. Can you elaborate?

Oh, gotcha. Yeah, I guess you should use the special glob syntax until #1134 is fixed.

@binyamin
Copy link
Member

binyamin commented Sep 6, 2020

Closing in favor of #1134

@binyamin binyamin closed this as completed Sep 6, 2020
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