Skip to content

Commit 16662f7

Browse files
committed
tweaks
1 parent b6c6f36 commit 16662f7

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

CLI/Program.cs

+15-5
Original file line numberDiff line numberDiff line change
@@ -178,17 +178,25 @@ private static void CompileProject(CompilerOptions options)
178178
watcher.IncludeSubdirectories = true;
179179
watcher.EnableRaisingEvents = true;
180180

181-
Console.WriteLine("Press \'q\' to quit.");
181+
Console.WriteLine("Started watcher! \'q\' to quit.");
182182
while (Console.Read() != 'q');
183183
}
184184
}
185185

186+
/// <summary>
187+
/// This method is called when a .hbs file changes!
188+
/// </summary>
189+
/// <param name="source"></param>
190+
/// <param name="e"></param>
186191
private static void OnChanged(object source, FileSystemEventArgs e)
187192
{
188-
Console.WriteLine("Change detected!");
189-
_workspace = CompileHandlebarsFiles(_project, _workspace, new List<string> { e.FullPath }, _options);
190-
var project = _workspace.CurrentSolution.Projects.First(x => x.Id.Equals(_project.Id));
191-
_project = project;
193+
if (ShouldCompileFile(e.FullPath, _options))
194+
{
195+
Console.WriteLine("Change detected!");
196+
_workspace = CompileHandlebarsFiles(_project, _workspace, new List<string> { e.FullPath }, _options);
197+
var project = _workspace.CurrentSolution.Projects.First(x => x.Id.Equals(_project.Id));
198+
_project = project;
199+
}
192200
}
193201

194202
/// <summary>
@@ -429,6 +437,8 @@ private static void ShowUsage()
429437
Console.WriteLine(" .net core Project: The compiler will not add compiled files to its project file");
430438
Console.WriteLine(" -d");
431439
Console.WriteLine(" Print diagnostic messages from MsBuildWorkspace");
440+
Console.WriteLine(" -w");
441+
Console.WriteLine(" Watch the target project for changes");
432442
Console.WriteLine("");
433443
Console.WriteLine("Directory Black- and Whitelists:");
434444
Console.WriteLine("-e<Exluded Directory> excludes a directory from compilation. Handlebars files in this folder will be ignored. Multiple statements possible.");

0 commit comments

Comments
 (0)