Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@
<Watch Remove="*.scss" />
</ItemGroup>

<!-- Deletes razor.css files that lack a corresponding razor.scss file in the project before the build process.
<!-- Deletes *.razor.css files that lack a corresponding .razor file in the project before the build process.
This is necessary in Blazor projects with Scoped CSS to prevent build errors caused by orphaned razor.css files,
which may remain after their source razor.scss files are deleted or renamed. For example, if a developer deletes
a razor.scss file and commits the change to Git, another developer who pulls the updated repository will have the
razor.scss file removed from their system, but the generated razor.css file may remain.
which may remain after their source razor files are deleted or renamed. For example, if a developer deletes
a razor, razor.cs and razor.scss files and commits the change to Git, another developer who pulls the updated repository will have the
razor, razor.cs and razor.scss file removed from their system, but the generated razor.css file may remain.
This orphaned razor.css file can cause build errors in the ApplyCssScopes task.
The following target ensures such files are deleted before the build, maintaining consistency and preventing errors. -->
<Target Name="DeleteUnmatchedRazorCss" BeforeTargets="ComputeCssScope">
<ItemGroup>
<RazorCssFiles Include="**\*.razor.css" />
<UnmatchedRazorCssFiles Include="@(RazorCssFiles)" Condition="!Exists('%(RecursiveDir)%(FileName).scss')" />
<UnmatchedRazorCssFiles Include="@(RazorCssFiles)" Condition="!Exists('%(RecursiveDir)%(FileName)')" />
</ItemGroup>
<Delete Files="@(UnmatchedRazorCssFiles)" />
</Target>
Expand Down
Loading