Exclude Files and Folders in Sublime 3 Search

When you are working on a project in Sublime 3 it is sometimes useful to exclude files and folders in Sublime 3 search. You typically do not want to search in minimized files, .map files and you often tend to want to exclude the node_modules directory. This can be done in Sublime 3. Just pick “Add Exclude Filter:

 

Sublime 3 Add Exclude Folder

and add the following:

, -*.map, -*.min.js, -*.min.css, -*/node_modules/

behind the folder you picked to search in and go for the item to search for. So the where bar could look like something like:

/Users/jasper/webdesign/vue-basics/todo-app,-*.map, -*.min.js, -*.min.css, -*/node_modules/*

Excluding Files

So as you can see you can exclude a file using -*.file-extension. Do not forget the minus! This will exclude all files that end in that extension. It really is as simple as that. You can of course add this to your preferences as well if you always want to exclude certain file types, but I tend to change this a lot from project to project. So I keep some copy and paste code around to quickly exclude stuff. Quick example here:

-*.min.css

Excluding Directories

If you want to exclude directories that pretty much goes the same as excluding files. You start with -* and then the directory in between / . For example:

-*/node_modules/*

 

Tagged in : Tagged in :
Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.