Skip to content

Commit

Permalink
Reload supported for .cshtml and .css files
Browse files Browse the repository at this point in the history
Fixed #6
  • Loading branch information
madskristensen committed May 5, 2017
1 parent 8024929 commit 610fe23
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
9 changes: 1 addition & 8 deletions src/BrowserLink/ReloadExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,11 @@ public void Dispose()

void FileChanged(object sender, FileSystemEventArgs e)
{
if (e.ChangeType != WatcherChangeTypes.Changed)
return;

string file = e.FullPath.ToLowerInvariant();
string ext = Path.GetExtension(file).TrimStart('.');

if (_extensions.Contains(ext) && !_ignorePatterns.Any(p => file.Contains(p)))
if (!string.IsNullOrEmpty(ext) && _extensions.Contains(ext) && !_ignorePatterns.Any(p => file.Contains(p)))
{
// Only reload on CSS file changes if it's a ASP.NET Core project, due to a bug in Browser Link
if (ext == "css" && !_project.Kind.Equals("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}", StringComparison.OrdinalIgnoreCase))
return;

Interlocked.Exchange(ref _state, 2);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public class Options : DialogPage
[Category("General")]
[DisplayName("Enable reload on save")]
[Description("When enabled, every time a file is saved the connected browsers will reload.")]
[DefaultValue(false)]
public bool EnableReload { get; set; }
[DefaultValue(true)]
public bool EnableReload { get; set; } = true;

[Category("General")]
[DisplayName("Delay")]
Expand Down

0 comments on commit 610fe23

Please sign in to comment.