-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to watch all files in a directory. #227
base: master
Are you sure you want to change the base?
Conversation
Deploy request for elm-live pending review. Review with commit 7080acc |
Adresses #196 |
ignoreInitial: true, | ||
followSymlinks: false, | ||
ignored: ['elm-stuff/generated-code/*', /ElmjutsuDumMyM0DuL3.elm/, /\/.#[^/]+\.elm/] | ||
ignored: [new RegExp(model.target), /.git/, /.vscode/, /.idea/, /node_modules/, /elm-stuff/, /ElmjutsuDumMyM0DuL3.elm/, /\/.#[^/]+\.elm/] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these new folders are "personal" to the developer, especially .vscode
and .idea
. For example, I might be using a different IDE that creates a different temp folder for caching, and the watcher will still listen to those files.
A solution would be check if there's a .gitignore
file, read it, and filter the folders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading .gitignore
might lead to other problems, for example when you are generating ignored source files that should still trigger a reload.
We could just force --dir
when using --watch
or are there use cases where you have to watch the current working directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's true. Forcing the dist
might help if you target another directory other than root, but if you still target the root then the problem will persist.
Maybe we can say "any path (file or folder) that starts with .
+ /node_modules/
etc, and a flag can be added, like --watchIgnore
in case the user wants to ignore additional folders.
Are there still plans to merge this PR? |
There was no consensus on how to implement this feature. Either we allow watching the root directory and add an option to ignore certain folders (e.g. |
Hey!
This pull request adds an option to watch for all file changes in the specified or default directory.
-w, --watch
Watches all files in the specified or default directory and triggers a reload if files change.
To work with the current working directory we have to ignores some common paths that may exist there (node_modules, .git, ...). Let's discuss what paths we should ignore by default or if we should only allow watching subdirectories.