-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
368 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'vite-imagetools': patch | ||
--- | ||
|
||
feat: caching of generated images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Caching | ||
|
||
To speed up a build pipeline with many images, the generated images can be cached on disk. | ||
If the source image changes, the cached images will be regenerated. | ||
|
||
## How to enable caching | ||
|
||
To enable caching, the cache directory has to be configured. | ||
|
||
``` | ||
// vite.config.js, etc | ||
... | ||
plugins: [ | ||
react(), | ||
imagetools({ | ||
cacheDir: './node_modules/.cache/imagetools' | ||
}) | ||
] | ||
... | ||
``` | ||
|
||
## Cache retention to remove unused images | ||
|
||
When an image is no longer there or the transformation parameters change, the previously | ||
cached images will be removed after a configurable retention period. | ||
The default retention is 86400 seconds. A value of 0 will disable this mechanism. | ||
|
||
``` | ||
// vite.config.js, etc | ||
... | ||
plugins: [ | ||
react(), | ||
imagetools({ | ||
cacheDir: './node_modules/.cache/imagetools', | ||
cacheRetention: 172800 | ||
}) | ||
] | ||
... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...in-test-ts-vite-imagetools-import-with-space-in-identifier-and-cache-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.