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

Using site.copy() with glob #53

Closed
valtlai opened this issue Apr 7, 2021 · 3 comments
Closed

Using site.copy() with glob #53

valtlai opened this issue Apr 7, 2021 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@valtlai
Copy link
Contributor

valtlai commented Apr 7, 2021

I have a directory with both .svg and other files. I would like to copy the files with site.copy("./assets"), but then the .svg files inside are copied without going through the plugin. If site.copy() would support globs, I could do site.copy("./assets/**/*.!(svg)") to copy all but the .svg files in the directory.

If this gets implemented, maybe site.ignore() should support globs too.

@oscarotero
Copy link
Member

oscarotero commented Apr 8, 2021

I didn't implement glob for performance reasons. Ignoring a directory is easier and faster because the source scanner stops when it reaches to this directory so it doesn't continue scanning and evaluating the files inside this directory (think, for example in a node_modules folder).

Maybe, a way to do it without affecting to performance could be by separating the glob patterns and folders names in two different Map, but I haven't done much research.

@shah
Copy link

shah commented Jun 20, 2021

For site.ignore() you can just allow passing in a function like this:

site.ignore((absFileName) => { // return true to keep, false to ignore })

This way you can support almost any rule.

@oscarotero oscarotero added the enhancement New feature or request label Apr 15, 2022
@oscarotero oscarotero added this to the 1.8.0 milestone Apr 16, 2022
@oscarotero
Copy link
Member

Implemented functions support to site.ignore(). I'm closing this.

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

No branches or pull requests

3 participants