How to exclude files from being watched by elm-live

I use elm-live to serve my Elm, app in development.

I run it like this:

elm-live src/Main.elm -d site -- --output=site/index.html

This works fine - until I create (via my editor Emacs) arbitrary backup file to some of the (code-wise uninteresting) Markdown files like a TODO.md I have in the project root. Here is what happens:

  1. I edit the TODO.md, Emacs creates a backup file .#TODO.md
  2. elm-live seems to watch the project root (Why? The source files are in src!) and finds the in-progress file .#TODO.md
  3. elm-live chokes on that file with:

[Error: ENOENT: no such file or directory, stat '/my/project/dir/.#TODO.md'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: '/my/project/dir/.#TODO.md'
}

So my question is: How can I avoid this? How can i exclude the root from being watched?

Thanks for any pointers!

elm-live is not maintained. You probably need to fork it and fix the bug yourself.

You can also try elm-watch. Its beta version (which is in fact quite stable) has a built-in HTTP server, and it might do everything you need.

1 Like

I had similar problems with other tools too. Add this to your emacs configuration:

(setq-default create-lockfiles nil)

1 Like

Good to know. Thanks.

This works. :grinning_face_with_smiling_eyes: Thanks heaps.

I might look into setting

lock-file-name-transforms

instead, so that lock files are still created, but in another directory.

1 Like