Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.

Commit 217e6f6

Browse files
committed
Build: Always Output GeneratedFiles TaskItem
1 parent 2480d12 commit 217e6f6

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

AspNetCore.SassCompiler.Tasks/CompileSass.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ private IEnumerable<ITaskItem> GenerateCss(SassCompilerOptions options)
228228
}
229229

230230
var hasSources = false;
231-
foreach (var compilation in options.GetAllCompilations())
231+
var compilations = options.GetAllCompilations();
232+
foreach (var compilation in compilations)
232233
{
233234
var fullSource = Path.GetFullPath(Path.Combine(rootFolder, compilation.Source));
234235
var fullTarget = Path.GetFullPath(Path.Combine(rootFolder, compilation.Target));
@@ -274,15 +275,22 @@ private IEnumerable<ITaskItem> GenerateCss(SassCompilerOptions options)
274275
var generatedFile = new TaskItem(cssFile);
275276
yield return generatedFile;
276277
}
277-
}
278278

279-
private (bool Success, string Output, string Error) GenerateCss(string arguments)
280-
{
281-
if (string.IsNullOrWhiteSpace(TargetFrameworks))
279+
// No files reported compiled by dart-sass in stdout but command successful.
280+
// Most likely due to the --update flag and no source changes.
281+
// For a simple source target file scenario always return the target filename to include in MSBuild ContentItems.
282+
if(compilations.Count() == 1)
282283
{
283-
return CompileCss(arguments);
284+
var targetFile = Path.GetFullPath(Path.Combine(rootFolder, compilations.First().Target));
285+
if (File.Exists(targetFile))
286+
{
287+
yield return new TaskItem(targetFile);
288+
}
284289
}
290+
}
285291

292+
private (bool Success, string Output, string Error) GenerateCss(string arguments)
293+
{
286294
var mutexName = GetMutexName();
287295

288296
Log.LogMessage(MessageImportance.Normal,

AspNetCore.SassCompiler/AspNetCore.SassCompiler.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>net6.0</TargetFramework>
55
<PackageId>MudBlazor.SassCompiler</PackageId>
6-
<Version>2.0.5</Version>
6+
<Version>2.0.6</Version>
77
<Authors>koenvzeijl,sleeuwen,Michaelvs97</Authors>
88
<Description>Sass Compiler Library for .NET 6 and above. without node</Description>
99
<PackageDescription>Sass Compiler Library for .NET 6 and above. without node, using dart-sass as a compiler</PackageDescription>

0 commit comments

Comments
 (0)