live-server icon indicating copy to clipboard operation
live-server copied to clipboard

Not ignoring .git files, despite being put in ignore params

Open jadchaar opened this issue 6 years ago • 7 comments

Hello! Really enjoying live-server, but I find that my level 2 log output gets cluttered quickly because a change is constantly detected in the file ./.git/index. I tried adding .git to my ignore params field, but it did not work. Things I tried in params: ignore: .git, ignore: .git/*, ignore: .*, and ignore: .git/**. Would love some help! Thanks.

jadchaar avatar Aug 09 '17 20:08 jadchaar

Hi, same story here.

This does not work for me:

live-server --ignore=".git, .idea"

I think the simple example in the readme for the CLI inputs would be great.

Thank you!


$ node --version
v8.9.0

$ live-server --version
live-server 1.2.0

pavelbinar avatar Nov 15 '17 15:11 pavelbinar

I was going to investigate it and possible fix it but after seeing 14 pull requests I wonder if this project is still maintained..

sebastianovide avatar Nov 24 '17 15:11 sebastianovide

I had a bit of a dig into it and I believe it is an issue with the underlying use of chokidar, but it's a bit of a ball of mud to try and sort out.

While the docs say --ignorePattern is deprecated, it still works so use --ignorePattern=".git*" and for multiple items e.g. a directory called docs use --ignorePattern=".git*|docs/*"

acarabott avatar Nov 29 '17 14:11 acarabott

Docs need some updating.. see: https://github.com/tapio/live-server/issues/178 @tapio @pavel this can be closed

devinrhode2 avatar Dec 10 '18 22:12 devinrhode2

Note: the solution (from #178) is to explictly tell live-server to start in the current directory (./). Then it will properly resolve --ignore paths:

live-server --ignore=.git,node_modules ./

unitof avatar Nov 01 '19 16:11 unitof

A hard looking for solution:

live-server --port=8000 --watch=./** --ignore=./dist/app.bundle.js.map,./src ./

./ To start on the current directory as @unitof said. --watch=./** To watch for all changes starting from the current directory. --ignore=./dist/app.bundle.js.map,./src To ignore the files and folders with a relative path.

belachkar avatar Dec 09 '19 01:12 belachkar

This also seems to work

live-server --ignore="$PWD/.git/**"

Ideally relative paths should be resolved to absolute paths ... The issue seems to be that by default the root dir is process.cwd() which is an absolute path, so ignore patterns should match against absolute paths. Considering that these are patterns, probably it would not be easy to resolve them to absolute patterns. So the best option seems to pass . as root dir as suggested above. Probably not a bug, but should be documented to avoid surprises.

dotchev avatar Nov 25 '20 07:11 dotchev