Browse Source

Added .html and .tmpl extensions to watchlist

Wirecog 7 years ago
parent
commit
25d05fb7b4
3 changed files with 12 additions and 1 deletions
  1. 2
    1
      kick.go
  2. 5
    0
      startstop_unixlike.go
  3. 5
    0
      startstop_windows.go

+ 2
- 1
kick.go View File

50
 
50
 
51
 func initializeWatcher(shouldRestart chan bool, dirList []string) {
51
 func initializeWatcher(shouldRestart chan bool, dirList []string) {
52
 
52
 
53
+	supportedExtensions := map[string]int{".go": 1, ".html": 1, ".tmpl": 1}
53
 	watcher, err := fsnotify.NewWatcher()
54
 	watcher, err := fsnotify.NewWatcher()
54
 	if err != nil {
55
 	if err != nil {
55
 		log.Fatal(err)
56
 		log.Fatal(err)
63
 			case event := <-watcher.Events:
64
 			case event := <-watcher.Events:
64
 
65
 
65
 				if event.Op == fsnotify.Write || event.Op == fsnotify.Rename {
66
 				if event.Op == fsnotify.Write || event.Op == fsnotify.Rename {
66
-					if filepath.Ext(event.Name) == ".go" {
67
+					if _, ok := supportedExtensions[filepath.Ext(event.Name)]; ok {
67
 						shouldRestart <- true
68
 						shouldRestart <- true
68
 					}
69
 					}
69
 				}
70
 				}

+ 5
- 0
startstop_unixlike.go View File

1
+// The Isomorphic Go Project
2
+// Copyright (c) Wirecog, LLC. All rights reserved.
3
+// Use of this source code is governed by a BSD-style
4
+// license, which can be found in the LICENSE file.
5
+
1
 // +build !windows
6
 // +build !windows
2
 
7
 
3
 package main
8
 package main

+ 5
- 0
startstop_windows.go View File

1
+// The Isomorphic Go Project
2
+// Copyright (c) Wirecog, LLC. All rights reserved.
3
+// Use of this source code is governed by a BSD-style
4
+// license, which can be found in the LICENSE file.
5
+
1
 // +build windows
6
 // +build windows
2
 
7
 
3
 package main
8
 package main