storyblok-check-unreferenced-assets
v1.0.12
Published
CLI tool for Storyblok: find unreferenced assets
Readme
Storyblok Unreferenced Assets Checker
A CLI tool to find unreferenced assets in your Storyblok space. This tool helps you identify assets that are no longer being used in any of your stories across all languages.
Installation
You can run this tool directly using npx:
npx storyblok-check-unreferenced-assetsUsage
The tool requires three parameters:
npx storyblok-check-unreferenced-assets \
--token YOUR_CONTENT_TOKEN \
--oauth-token YOUR_OAUTH_TOKEN \
--space-id YOUR_SPACE_IDRequired Parameters
--token: Your Storyblok Content Delivery API token--oauth-token: Your Storyblok OAuth token--space-id: Your Storyblok space ID
How it Works
- Fetches all available languages from your Storyblok space
- Retrieves all stories across all languages
- Fetches all assets from your space
- Analyzes each asset to check if it's referenced in any story
- Generates a JSON file (
unreferenced-assets.json) containing all unreferenced assets
Output
The tool will create an unreferenced-assets.json file in the current directory, containing details of all assets that are not referenced in any story. Each asset entry includes:
- Filename
- Asset ID
- Creation date
- Last modified date
- File size
- Content type
Getting the Required Tokens
Content Delivery API Token:
- Go to your Storyblok space settings
- Navigate to the "Access Tokens" tab
- Create or use an existing Content Delivery API token
OAuth Token:
- Go to your Storyblok account settings
- Navigate to "Personal Access Tokens"
- Create a new token with the necessary permissions
License
MIT
