jsonwatchglitch-framework

glitch.com watch file not working properly


I am creating a watch.json file on glitch.com, following these instructions: https://glitch.happyfox.com/kb/article/60-can-i-change-which-files-cause-my-app-to-restart/

My goal is to NOT automatically restart the browser page after every edit in JS or CSS files. Or when it does, it should throttle to reload only after 50 seconds.

{
  "install": {
    "include": [
      "^package\\.json$",
      "^\\.env$"
    ]
  },
  "restart": {
    "exclude": [
      "^public/",
      "^dist/",
      "\\.js$",
      "\\.md$",
      "\\.html$",
      "\\.css$"
    ],
    "include": [
      "\\watch.json"
    ]
  },
  "throttle": 50000
}

Sadly, this doesn't seem to work. Any change in JS or CSS files will immediately cause a reload. What could be wrong?

The glitch project is here: https://glitch.com/edit/#!/ml5test-two


Solution

  • The watch.json file refers to build/restart times for full-stack apps, not browser window refreshes. You can turn off "refresh app on changes" in the project menu in the editor. See: https://help.glitch.com/kb/article/46-can-i-turn-off-or-on-automatic-refreshing-of-the-app-preview-when-i-make-changes/