1.1.1 • Published 6 months ago
cleanup-unused-images v1.1.1
Cleanup Unused Images
A tool to find and delete unused image files in your project.
🚀 Installation
npm install -g cleanup-unused-images
📖 Usage
1. Direct Usage
# Check unused images (without deletion)
cleanup-images
# Check and delete unused images
cleanup-images -d
# Specify project directory
cleanup-images -p /path/to/project
2. Integration with package.json
{
"scripts": {
"cleanup": "cleanup-images",
"cleanup:delete": "cleanup-images -d"
}
}
3. Run script from package.json by npm or yarn
npm run cleanup
npm run cleanup:delete
⚙️ Options
Option | Description | Default |
---|---|---|
-d, --delete | Delete unused image files | false |
-p, --directory | Path to project directory | Current directory |
🖥️ Display Results
// Results will be displayed in English
{
"Images tested": "100",
"Unused images": "15",
"Directory tested": "/project/path",
"Processing status": "Completed"
}
⚠️ Important Notes
- Backup your project before running
- Test without
-d
flag first - Carefully review the list of images to be deleted
- Tool will search in files:
.tsx
,.jsx
,.js
,.ts
.css
,.scss
.html
,.md
🔍 Supported Image Formats
.png
.jpg
,.jpeg
.gif
.webp
.svg
.ico
📋 System Requirements
- Node.js 14.x or higher
- npm or yarn
🐛 Troubleshooting
If you encounter issues:
- Check directory permissions
- Ensure
public
directory exists - Verify supported image formats
- Run without
-d
flag for debugging
🤝 Contributing
All contributions are welcome! Please create an issue or pull request.
📄 License
MIT
📞 Support
If you need help:
- Create an issue on GitHub
- Check existing issues
- Read the documentation carefully
💖 Donate
If you find this tool helpful, you can support the development by donating:
- Email: trieunguyen200064@gmail.com
- PayPal: Donate via PayPal
Made with ❤️ to keep your projects cleaner