Skip to content

Commit fdc97a9

Browse files
document Workers Static Assets .assetsignore file
1 parent 7233431 commit fdc97a9

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/content/docs/workers/static-assets/binding.mdx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,32 @@ assets = { directory = "./public/" }
3737

3838
</WranglerConfig>
3939

40-
## `binding`
40+
### Ignoring assets
4141

42-
Configuring the optional [binding](/workers/runtime-apis/bindings) gives you access to the collection of assets from within your Worker script.
42+
Sometime there are files in the asset directory that should not be uploaded.
43+
44+
In this case create a `.assetsignore` file in the root of the assets directory.
45+
This file takes the same format as `.gitignore`.
46+
47+
Wrangler will not upload asset files that match lines in this file.
48+
49+
**Example**
4350

51+
You are migrating from a Pages project where the assets directory is `dist`.
52+
You do not want to upload the server-side Worker code nor Pages configuration files as public client-side assets.
53+
Add the following `.assetsignore` file:
4454

55+
```gitignore
56+
_worker.js
57+
_redirects
58+
_headers
59+
```
60+
61+
Now Wrangler will not upload these files as client-side assets when deploying the Worker.
62+
63+
## `binding`
64+
65+
Configuring the optional [binding](/workers/runtime-apis/bindings) gives you access to the collection of assets from within your Worker script.
4566

4667
<WranglerConfig>
4768

0 commit comments

Comments
 (0)