VS Code Extension - Unused File Cleaner
📌 Overview
This Visual Studio Code extension scans your project to identify unused files, including images, CSS, and JavaScript files. Instead of deleting them, it moves unused files to a separate folder so you can review them manually.
✨ Features
- Scans HTML, PHP, CSS, and JS files for file references.
- Detects unused CSS, JS, PNG, JPG, JPEG, GIF, SVG, WEBP files.
- Moves unused files to an
unused_files
folder instead of deleting them.
- Ensures referenced files inside nested directories are also checked.
🛠 Installation
1️⃣ Install from VSIX File
If you have the packaged .vsix
file, install it manually:
code --install-extension unused-file-cleaner.vsix
Or manually in VS Code:
- Open VS Code.
- Go to Extensions (
Ctrl + Shift + X
).
- Click on the three-dot menu (⋮) > Install from VSIX....
- Select your
.vsix
file.
🚀 How to Use
- Open your project folder in VS Code.
- Press
Ctrl + Shift + P
and search for Clean Unused Files
.
- Run the command.
- If unused files are found, they will be moved to the
unused_files
folder.
- Review them manually before deleting.
🔄 Development & Running Locally
1️⃣ Clone the Repository
git clone https://github.com/your-repo/unused-file-cleaner.git
cd unused-file-cleaner
2️⃣ Install Dependencies
npm install
3️⃣ Run the Extension Locally
npm run compile
code .
- Press
F5
to launch a new VS Code window with the extension loaded.
- Test the extension in the new window.
📦 Packaging the Extension
To package your extension as a .vsix
file, run:
npm install -g @vscode/vsce
vsce package
This will generate unused-file-cleaner.vsix
.
⚠️ Notes
- This extension does not delete files automatically. It only moves unused files to the
unused_files
folder.
- Ensure that your project is fully indexed before running the command.
- If a file is used dynamically (e.g., in JavaScript or PHP), the extension may not detect it. Always review before deleting.
📝 License
MIT License.
💡 Contributions
Feel free to fork this repo and submit a PR if you find a bug or have improvements!
🚀 Happy Coding!