Cleanup Storyblok assets
storyblok-assets-cleanup is a CLI utility to find and delete unused assets (images, videos, documents, etc) in the Storyblok CMS.
Features:
- Find assets without references;
- Output a summary of assets to be deleted, grouped by folder;
- Perform a backup of assets before deletion;
- Delete the actual assets.
Getting started
Requirements
- Have a Storyblok space and create a personal access token
Installation
In order to keep your system tidy and without conflicts in your global and user packages, we recommend pipx:
pipx install storyblok-assets-cleanup
This should do the trick for all systems. Adapt the installation command to fit your and preferred tool.
Use pipx upgrade storyblok-assets-cleanup to update to the latest release.
Check the package releases on PyPI.
Usage
usage: storyblok-assets-cleanup [-h] --token TOKEN --space-id SPACE_ID [--region {eu,us,ca,au,cn}]
[--delete | --no-delete] [--backup | --no-backup]
[--backup-directory BACKUP_DIRECTORY] [--cache | --no-cache]
[--cache-directory CACHE_DIRECTORY]
[--continue-download-on-failure | --no-continue-download-on-failure]
[--ignore-path IGNORE_PATH] [--ignore-word IGNORE_WORD]
storyblok-assets-cleanup an utility to delete unused assets.
options:
-h, --help show this help message and exit
--token TOKEN Storyblok personal access token, alternatively use the env var
STORYBLOK_PERSONAL_ACCESS_TOKEN.
--space-id SPACE_ID Storyblok space ID, alternatively use the env var STORYBLOK_SPACE_ID.
--region {eu,us,ca,au,cn}
Storyblok region (default: EU)
--delete, --no-delete
If we should delete assets, default to false.
--backup, --no-backup
If we should backup assets (to the directory specified in `--backup-
directory`), defaults to true.
--backup-directory BACKUP_DIRECTORY
Backup directory, defaults to ./assets_backup.
--cache, --no-cache If we should use cache the assets index. Defaults to True (recommended).
--cache-directory CACHE_DIRECTORY
Cache directory, defaults to ./cache.
--continue-download-on-failure, --no-continue-download-on-failure
If we should continue if the download of an asset fails. Defaults to true.
--ignore-path IGNORE_PATH
Absolute filepaths that should be ignored, can be passed multiple times.
Does not support prefixes, meaning you would need to pass the full path
for each directory, as seen in the summary table (with starting slash and
without trailing slash). Optional, defaults to no blacklisted paths.
Example: --ignore-path '/Do not delete/emails' --ignore-path '/Do not
delete/logos'.
--ignore-word IGNORE_WORD
Will not delete assets which contains the specified words in its filename.
Default to none/empty list.
Development
- Ensure you have
makeinstalled. - Create a virtual environment:
make setup-venv. - Install dependencies:
make install-deps.
Then you can install (link) the local repository globally with make local-install.
Before pushing changes ensure your code is properly formatted with make lint.
Auto format the code with make format.
License
MIT
Metadata
Release files for storyblok-assets-cleanup 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| storyblok_assets_cleanup-1.2.2.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| storyblok_assets_cleanup-1.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.2 kB
Release files / storyblok_assets_cleanup-1.2.2.tar.gz
| Download URL | storyblok_assets_cleanup-1.2.2.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3be3fedee0527ec3d72ae8195d4f76a7b40f2056e7a72814411553efa9db1925
|
|
BLAKE2b-256 checksum How to use checksums |
db69aab64989b89cc30a8f85f93f77e2eeec84828a3faefc1e044270424c53b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / storyblok_assets_cleanup-1.2.2-py3-none-any.whl
| Download URL | storyblok_assets_cleanup-1.2.2-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f017388bc170da02c7ef2fb86dfee32ba165255589fcc4e0a1ea22b1ce3b256
|
|
BLAKE2b-256 checksum How to use checksums |
58e247e13569cd29a3681efc95fe07390acb09bd21124e51f224626477fdea97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|