exclude dir when watching .coffee
Closed this issue · 4 comments
When running coffee -bwc ./, can certain directories be ignored, as I am encountering a 'too many files watch' warning? There are many directories in the project that do not need to be watched by CoffeeScript, and I hope to exclude them.
Generally people don’t watch the root of the project. Put your code one level down in a folder like src and watch that.
Generally people don’t watch the root of the project. Put your code one level down in a folder like
srcand watch that.
Hi,
My project is entirely written in CoffeeScript, including the entry file main. From the beginning, I adopted the approach of watching the entire project directory. However, as the project has grown significantly in size and complexity, it has become impossible for me to separate the components out. The project directory contains many nested CoffeeScript sub-projects, each with its own node_modules directory, including Cordova. The large number of directories is causing issues with the directory watching.
I am really hoping for something similar to a .gitignore file that can exclude these directories from being watched. Unfortunately, I am currently unable to refactor the project structure due to its complexity and the interdependencies between the sub-projects.
Any suggestions or solutions would be greatly appreciated.
(Note: The content above was translated from Chinese using AI.)
If you're not dynamically adding files, you should be able to specify which files you want to watch more precisely. Even this should improve things (by directly watching .coffee files instead of all directories):
coffee -bwc **/*.coffeeYou could also specify which directories to watch, including the root directory, to avoid including node_modules etc. For example:
coffee -bwc *.coffee {project1,project2,project3,source}/**/*.coffeeBasically, use more precise inclusions, given that you can't exclude.
If you're not dynamically adding files, you should be able to specify which files you want to watch more precisely. Even this ...
Oh, so it can be done this way. I'll give it a try later.