#Find Unused Files
A Brackets editor extension to find unused files in your web project
You can launch an unused files detection by clicking "Edit" > "Find unused file". The list of unused files will be display in the bottom panel.
- List all file from the web project.
- Extract of this list , all the files likely to call another file. > First list
- Extract of this list , all the file names likely to don't be used. > Second List
- Check if the content of each file of the first list contains the name of a file of the second list
- When a file of the second list is called, remove it from the list.
- List all the file which are never called.
The extension will search the call of a : PNG, JPG, JPEG, GIF, SVG, BMP, ICO, JS, CSS in files : HTML, HTM, CSS, PHP, JS, ASPX, ASCX, CSHTML, LESS, SCSS, SASS, JSON, MD
A file isn't used when it's name isn't called in another file. For example, if file names are generated in loops :
for (var i = 0; i < 5; i++){
console.log('image_' + i + '.jpg');
}
The filename "image_3.jpg" isn't written in this few lines but this file is called once the code executed. So, a file in the list can be useful, always checked the files before deleting them.
This extension scans the current project, so if a file is called in another project or by another website, this file cannot be considered as used.
The result is almost instantaneous in a web project containing less than 3000 files. I tested on a web project of 10 000 files and the editor freezes, the list of unused files is shown after few minutes... I will try to reduce the analyzing speed in future versions.