Skip to content

A lightweight VS Code extension to detect and remove unused static assets (like images, PDFs, etc.) from your project — perfect for cleaning up the public/ folder in Next.js and other web apps.

Notifications You must be signed in to change notification settings

mohitkumawat310/unused-assets-remover

Repository files navigation

🧹 Unused Assets Remover

Remove unused images, icons, and other static assets from your project effortlessly.

This Visual Studio Code extension helps you find and delete unused static assets (e.g., images in the public folder of a Next.js app) that are no longer referenced in your source code. It helps keep your project clean and lightweight.


🚀 Features

  • ✅ Automatically scans your public or custom assets folder.
  • ✅ Detects references to assets across your codebase.
  • ✅ Supports JavaScript, TypeScript, HTML, JSON, CSS files, and more.
  • ✅ Lets you preview and select unused files before deleting them.
  • ✅ Ignores system and build folders (node_modules, .git, .next, etc.).
  • ✅ Fully configurable via input prompts.

📸 Example Use Case

You're working on a Next.js project and have accumulated many images in the public/images folder. Some of them are no longer used in the code. Instead of manually checking and deleting them, you can:

  1. Run this extension.
  2. Let it analyze your project.
  3. Select the unused assets you want to delete.
  4. Clean your codebase — in seconds.

🛠️ How to Use

  1. Open your project folder in VS Code.
  2. Open the Command Palette (Press Ctrl+Shift+P or Cmd+Shift+P).
  3. Search and run:
    Unused Assets Remover: Clean Up Assets
  4. Follow the prompts:
    • Enter the path to your assets folder (e.g., public, public/images).
    • Provide a search prefix (e.g., / for /image.png, /images for /images/photo.jpg).
    • Optionally, define folders to ignore (e.g., node_modules,.git).
  5. Select which unused files to delete.
  6. Confirm and enjoy a cleaner project! ✨

📁 File Types Supported

  • .js, .jsx
  • .ts, .tsx
  • .html
  • .json
  • .css

🔐 Permissions

This extension only scans and modifies files within your workspace folder. No external calls or telemetry.


💡 Tips

  • Works great with Next.js and other web frameworks that serve static files.
  • Make sure your dynamic asset references (like via JavaScript variables or Next.js Image components with dynamic src) are correctly handled or excluded manually.

🧰 Requirements

  • Visual Studio Code
  • Node.js (required for development only)

❓ FAQ

Q: Can it delete assets inside nested folders?
Yes, the scan is recursive and includes all subfolders inside the specified asset directory.

Q: Is it safe to use?
Yes! You can preview and manually select which unused files to delete. No automatic deletions.

Q: Is this extension free?
Absolutely.


🧑‍💻 Contributing

Feel free to open issues or PRs to improve detection logic, add support for more file types, or improve performance.


📄 License

MIT License


Enjoy a cleaner, lighter codebase! 🌿