question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ignore specific file type in directory and all sub-directories?

See original GitHub issue

I have been trying to ignore a specific file type in a directory and all its subdirectories, however nodemon keeps reloading regardless.

Expected behaviour

For example, I am trying to ignore all js files in the views directory as well as any subdirectories. I am currently using a nodemon.json file with the following config object:

{ "verbose": true, "ignore": ["views/*.js", "views/**/*.js"], "ext": "js, ejs, json" }

Actual behaviour

Nodemon still reloads on saving any js file in any subdirectory of the “views” folder.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
amhassen97commented, Oct 17, 2021

Turns out I had forgotten the last change I made to the config file. The original glob pattern does not work, however the following does:

{ "verbose": true, "ext": "js, ejs, json", "ignore": ["views\\**\\*.js"] } I am not sure why, but it may have something to do with the backslashes in the file paths matching the pattern check.

0reactions
amhassen97commented, Oct 17, 2021

I restarted and it seems to be working now. Seems I misunderstood the console logs, nodemon was not actually restarting, just running a file check to check if reload needs to be done. Apologies for the confusion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

gitignore all files of extension in directory - Stack Overflow
This will ignore all .js files in your git repository. To exclude certain type of file from a particular directory, you can add...
Read more >
.gitignore File – How to Ignore Files and Folders in Git
Inside .gitignore , you can tell Git to ignore only a single file or a single folder by mentioning the name or pattern...
Read more >
Git Tutorial => Ignoring files and directories with a .gitignore file
You can make Git ignore certain files and directories — that is, exclude them from being tracked by Git — by creating one...
Read more >
.gitignore file - ignoring files in Git | Atlassian Git Tutorial
Git ignore patterns are used to exclude certain files in your working directory from your Git history. They can be local, global, or...
Read more >
Ignoring Files and Directories in Git (.gitignore) - Linuxize
A local .gitignore file is usually placed in the repository's root directory. However, you can create multiple .gitignore files in different ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found