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
Copy file name to clipboardExpand all lines: README.md
+13-2Lines changed: 13 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,8 @@ This npm package provides a solution for **inserting any JS client application i
16
16
17
17
> Starting with version v1.3.0, c++ defines can be used.
18
18
19
+
> Version v1.4.0 has a breaking change! --no-gzip changed to --gzip. Starting with this version c++ compiler directives are available to setup operation in project level.
20
+
19
21
### Usage
20
22
21
23
**Install package** as devDependency (it is practical if the package is part of the project so that you always receive updates)
@@ -160,7 +162,10 @@ All modern browsers have been able to handle gzip-compressed content for years.
160
162
161
163
During the translation process, data in gzip format is generated and will be used if the **size is greater than 100 bytes** and we experience a **reduction of at least 15%**. In such a case, the compressed data is unconditionally sent to the browser with the appropriate **Content-Encoding** header information.
162
164
163
-
Automatic compression can be turned off with the `--no-gzip` option.
165
+
Automatic compression can be turned off with the `--gzip=false` option.
166
+
167
+
> This setting has three states: yes, no, and compiler mode is available. In compiler mode, you can disable/enable Gzip by setting the `SVELTEESP32_ENABLE_GZIP` c++ compiler directive.
168
+
> For example, if using platformio, you can use `-D SVELTEESP32_ENABLE_GZIP`.
164
169
165
170
### ETag
166
171
@@ -170,6 +175,9 @@ Since microcontroller data traffic is moderately expensive, it is an individual
170
175
171
176
The use of ETag is **not enabled by default**, this can be achieved with the `--etag=true` switch.
172
177
178
+
> This setting has three states: yes, no, and compiler mode is available. In compiler mode, you can disable/enable ETag by setting the `SVELTEESP32_ENABLE_ETAG` c++ compiler directive.
179
+
> For example, if using platformio, you can use `-D SVELTEESP32_ENABLE_ETAG`.
180
+
173
181
### Main entry point - index.html
174
182
175
183
Typically, the entry point for web applications is the **index.htm or index.html** file. This does not need to be listed in the browser's address bar because web servers know that this file should be served by default. Svelteesp32 also does this: if there is an index.htm or index.html file, it sets it as the main file to be served. So using `http://esp_xxx.local` or just entering the `http://x.y.w.z/` IP address will serve this main file.
@@ -214,6 +222,9 @@ You can include a blocker error if a named file accidentally missing from the bu
214
222
...
215
223
```
216
224
225
+
You can use the following c++ directives at the project level if you want to configure the usage there. Do not forget `--etag=compiler` or `--gzip=compiler` command line arg:
226
+
`SVELTEESP32_ENABLE_ETAG` and `SVELTEESP32_ENABLE_GZIP`
227
+
217
228
### Command line options
218
229
219
230
| Option | Description | default |
@@ -222,7 +233,7 @@ You can include a blocker error if a named file accidentally missing from the bu
222
233
|`-e`| The engine for which the include file is created (psychic/async) | psychic |
223
234
|`-o`| Generated output file with path |`svelteesp32.h`|
224
235
|`--etag`| Use ETag header for cache (true/false/compiler) | false |
225
-
|`--no-gzip`| Do not compress content with gzip | false -> gzip used|
236
+
|`--gzip`| Compress content with gzip (true/false/compiler)| true|
226
237
|`--espmethod`| Name of generated method |`initSvelteStaticFiles`|
227
238
|`--define`| Prefix of c++ defines |`SVELTEESP32`|
0 commit comments