Skip to content

Commit d4138df

Browse files
pkestyfleMatthew Sweeney
authored
doc: Add allowlist pattern for .nowignore (#1615)
* doc: Add whitelisting approach Inspiration taken from this discussion: https://spectrum.chat/zeit/general/whitelisting-with-nowignore-not-straightforward-needs-to-be-in-docs~9e260aec-3d7c-49a2-ac38-a31d2ee92dce?m=MTU0ODMzODY0ODQxNQ== * Apply suggestions from code review Co-Authored-By: Steven <[email protected]> Co-authored-by: Steven <[email protected]> Co-authored-by: Matthew Sweeney <[email protected]>
1 parent e0c5eac commit d4138df

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pages/guides/prevent-uploading-sourcepaths-with-nowignore.mdx

+17
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,23 @@ private.html
3232
An example <InlineCode>.nowignore</InlineCode> file.
3333
</Caption>
3434

35+
## Allowlist
36+
37+
A typical `.nowignore` file assumes all files are allowed and each entry is a pattern to ignore. Alternatively, you may chose to ignore all files and each entry is a pattern to allow.
38+
The first step is to add a wildcard `/*` as the first line in `.nowignore`. This will ensure all directories and files in the project root are ignored. The following lines must start with a `!` to invert the ignore action and ensure the directory or file is allowed.
39+
40+
```
41+
# Ignore everything (folders and files) on root only
42+
/*
43+
!api
44+
!now.json
45+
!*.html
46+
```
47+
48+
<Caption>
49+
An example <InlineCode>.nowignore</InlineCode> file using the "allowlist" pattern.
50+
</Caption>
51+
3552
## Uploaded Files
3653

3754
Aside from the [default exclusions](/docs/v2/build-step/#ignored-files-and-folders), all files within your project are uploaded to ZEIT Now if no source path is specified to be excluded in a [`.nowignore` configuration file](https://zeit.co/docs/v2/deployments/ignoring-source-paths).

0 commit comments

Comments
 (0)