teamnovu / statamic-unused-assets
Addon to list all assets not in use on your Statamic dashboard.
Installs: 8 492
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 3
Requires
- statamic/cms: ^4.0 || ^5.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.13
README
This is an addon to list all assets that are not used in your statamic site.
Features
This addon adds a widget which you can add to your dashboard. If there are assets which are currently not in use on your sites they will be listed in that widget.
How to Install
Run the following command in your project root:
composer require teamnovu/statamic-unused-assets
How to Use
Just add the widget to your config/statamic/cp.php
as you would any other widget.
The following is an example which shows all the possible config values you can use.
'widgets' => [ // ... [ 'type' => 'unused-assets', // Required 'limit' => 300, // Default: 300 – The number of images to display from the widget. 'width' => 100, // Default: 100 – The size of the widget. 'excluded_paths' => [], // Example: ['assets/myFolder/'] - Default: [] – The paths to exclude from the search. ], ],
Note This widget caches the assets displayed forever and updates the cache when events such as AssetDeleted, AssetSaved AssetUploaded EntryDeleted, EntrySaved TermDeleted, TermSaved GlobalSetDeleted, GlobalSetSaved are fired.
Development
This addon workers due to the potential heavy workload. To test the addon localy a queue worker needs to be running e.g.
php artisan queue:listen
Credit
This widget has basically been extracted from the Statamic Peak starter kit updated with inspiration from Swiftmade Statamic Clear Assets