You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make compression-zstd opt-in and add documentation
Changes:
- Remove compression-zstd from default features (requires C bindings)
- Add comprehensive documentation for zstd compression feature
- Document compression functions and config methods
- Reorganize README features section for clarity
The zstd feature is now opt-in due to its C library dependency,
which may not be compatible with all build environments.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+25-4Lines changed: 25 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,9 +76,11 @@ archives already don't include their compressed versions. However you can
76
76
77
77
## Features
78
78
79
-
Both of the following features are enabled by default.
79
+
### Default Features
80
80
81
-
### `interpolate-folder-path`
81
+
The following features are enabled by default.
82
+
83
+
#### `interpolate-folder-path`
82
84
83
85
Allow environment variables and `~`s to be used in the `folder` path. Example:
84
86
@@ -91,7 +93,7 @@ struct Asset;
91
93
`~` will expand into your home folder, and `${PROJECT_NAME}` will expand into
92
94
the value of the `PROJECT_NAME` environment variable.
93
95
94
-
### `include-exclude`
96
+
####`include-exclude`
95
97
96
98
You can filter which files are embedded by adding one or more `#[include = "*.txt"]` and `#[exclude = "*.jpg"]` attributes.
97
99
Matching is done on relative file paths --the paths you use for the `.get` call-- via [`globset`](https://docs.rs/globset/latest/globset/).
@@ -111,7 +113,26 @@ For example, if you wanted to exclude all `.svg` files except for one named
111
113
structAssets;
112
114
```
113
115
114
-
### `prefix`
116
+
### Optional Features
117
+
118
+
#### `compression-zstd`
119
+
120
+
Enables zstd compression support for embedded files. When enabled, files will be compressed with zstd (in addition to gzip and brotli), allowing you to serve zstd-compressed content to clients that support it.
121
+
122
+
**Note:** This feature is **not enabled by default** because the `zstd` crate uses C bindings, which may not be compatible with all build environments.
123
+
124
+
To enable zstd compression, add this to your `Cargo.toml`:
125
+
126
+
```toml
127
+
[dependencies]
128
+
rust-embed-for-web = { version = "11.2.1", features = ["compression-zstd"] }
129
+
```
130
+
131
+
You can also disable zstd compression for specific embeds using the `#[zstd = false]` attribute as described in the "Disabling compression" section above.
132
+
133
+
### Other Configuration
134
+
135
+
#### `prefix`
115
136
116
137
You can specify a prefix, which will be added to the path of the files. For example:
0 commit comments