Exclude and Include Paths
You can configure custom exclude and include paths for your site with the excludePaths
and includePaths
keys in the Federalist configuration file.
Syntax
The excludePaths
and includePaths
keys in Federalist configuration file should include a list of unix-style glob
patterns to match against the paths of individual files to be deployed for your site.
Example
{
"excludePaths": [
"/some-exact/file.yml",
"*/all-files-with-this-name.txt"
],
"includePaths": [
"/.some-dot-file"
]
}
Path Pattern Matching Rules
- These patterns are applied against all of the files to be deployed for your site. For the
static
build engine, this is the root of your project, but for other build engines, matching is applied after the build process, that is, for the resulting files in the_site
folder.
Tip
Many libraries already provide a mechanism to exclude files from the results of the build, which should be preferred since it can be tested locally.
includePaths
have priority overexcludePaths
so that you have the ability to override platform defaults as well as include specific files, such as dotfiles, when most should be excluded.
Tip
For engines with a build step, the files to be included must not be excluded by your build process. For example, Jekyll excludes dotfiles by default, so you would have to also configure Jekyll to include the desired files.
-
All unix-style
glob
are supported. -
The paths against which the specified patterns are applied always begin with a
/
.
Note
These are different matching rules than apply for custom headers.
Examples
Pattern | Description |
---|---|
*/file.txt |
matches all (nested or not) files named file.txt |
/file.txt |
matches exactly /file.txt |
/folder* |
matches exactly folders with names starting with /folder and their contents |
/folder/* |
matches the contents of /folder |
/folder |
matches exactly /folder but not it’s contents |
See unix-style glob
for all possibilities.
Defaults
Excluded files
- all files named
Dockerfile
- all files named
docker-compose.yml
/federalist.json
/pages.json
- all dotfiles (files and folders starting with
.
)
Included files
.well-known/security.txt
As configuration
{
"excludeFiles": [
"*/Dockerfile",
"*/docker-compose.yml",
"/federalist.json",
"/pages.json"
],
"includeFiles": [
"/.well-known/security.txt"
]
}