Allow dotnet-watch to look for changes to .razor.css files (#25792)

Fixes https://github.com/dotnet/aspnetcore/issues/25483
This commit is contained in:
Pranav K 2020-09-13 14:46:47 -07:00 committed by GitHub
parent bfc1ec6792
commit ab5dfe5374
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View File

@ -275,5 +275,17 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.BuildPassed(result);
Assert.BuildOutputContainsLine(result, $"RazorTasksPath: {expected}");
}
[Fact]
[InitializeTestProject("ComponentApp")]
public async Task IntrospectRazorSdkWatchItems()
{
// Arrange
var result = await DotnetMSBuild("_IntrospectWatchItems");
Assert.BuildPassed(result);
Assert.BuildOutputContainsLine(result, "Watch: Index.razor");
Assert.BuildOutputContainsLine(result, "Watch: Index.razor.css");
}
}
}

View File

@ -877,7 +877,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<Target Name="_RazorSdkCustomCollectWatchItems">
<ItemGroup>
<Watch Include="%(Content.FullPath)" Condition="'%(Content.Extension)' == '.razor' AND '%(Content.Watch)' != 'false'" />
<Watch Include="%(Content.FullPath)" Condition="'%(Content.Extension)' == '.razor.css' AND '%(Content.Watch)' != 'false'" />
<Watch Include="%(None.FullPath)" Condition="$([System.String]::Copy('%(None.FullPath)').EndsWith('.razor.css')) AND '%(None.Watch)' != 'false'" />
<Watch Include="%(Content.FullPath)"
Condition="'$(_Targeting30OrNewerRazorLangVersion)' == 'true' AND '$(AddCshtmlFilesToDotNetWatchList)' != 'false' AND '%(Content.Extension)' == '.cshtml' AND '%(Content.Watch)' != 'false'" />
</ItemGroup>

View File

@ -47,6 +47,10 @@
<Message Text="Content: %(Content.Identity) CopyToOutputDirectory=%(Content.CopyToOutputDirectory) CopyToPublishDirectory=%(Content.CopyToPublishDirectory) ExcludeFromSingleFile=%(Content.ExcludeFromSingleFile)" Importance="High" />
</Target>
<Target Name="_IntrospectWatchItems" DependsOnTargets="_RazorSdkCustomCollectWatchItems">
<Message Text="Watch: %(Watch.FileName)%(Watch.Extension)" Importance="High" />
</Target>
<Target Name="_IntrospectRazorTasks">
<PropertyGroup>
<_SdkTaskPath>$([System.IO.Path]::GetFullPath('$(RazorSdkBuildTasksAssembly)'))</_SdkTaskPath>