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

Add includeFiles and excludeFiles to mount configuration #9042

Closed
bep opened this issue Oct 15, 2021 · 1 comment · Fixed by #9059
Closed

Add includeFiles and excludeFiles to mount configuration #9042

bep opened this issue Oct 15, 2021 · 1 comment · Fixed by #9059

Comments

@bep
Copy link
Member

bep commented Oct 15, 2021

We have the ignoreFiles option, but it only works for a sub-set of Hugo's source files (content, data?), and changing it to mean something else would create havoc.

Long story short, what would be relatively simple to implement and pretty powerful is to add a filter option to the mount config, e.g.:

[module]
[[module.mounts]]
source = 'content'
target = 'content'
includeFiles = ['blog/**', 'docs/**']
excludeFiles = '**.jpg'

Some notes about the above:

  • The include/exclude patterns are the regular Glob we use in other places; much faster than regexp and easier for people to reason about when it comes to file paths. They should contain Unix slashes even if on Windows.
  • We accept either a string or a slice for these options.
  • Since this needs to work on all file operations (dir listing, .Stat, .Open), we need to do this on the file system level.

/cc @regisphilibert @jmooring etc.

@bep bep added the Proposal label Oct 15, 2021
@bep bep added this to the v0.89 milestone Oct 15, 2021
@bep bep closed this as completed in #9059 Oct 20, 2021
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant