Skip to content

Commit

Permalink
Skip adding namespaces if module doesn't need ThemeModule.
Browse files Browse the repository at this point in the history
Resolve #19254
  • Loading branch information
maliming committed Jan 27, 2025
1 parent e25c2cb commit dcf093f
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ protected virtual void ChangeToBasicTheme(ProjectBuildContext context)
{
var defaultThemeName = context.BuildArgs.TemplateName is AppTemplate.TemplateName or AppNoLayersTemplate.TemplateName
? LeptonXLite : LeptonX;

new RemoveFilesStep($"/Themes/{defaultThemeName}").Execute(context);

ChangeThemeToBasicForMvcProjects(context, defaultThemeName);
ChangeThemeToBasicForBlazorProjects(context, defaultThemeName);
ChangeThemeToBasicForBlazorServerProjects(context, defaultThemeName);
Expand Down Expand Up @@ -622,6 +622,11 @@ private static void AddNamespaces(ProjectBuildContext context, string targetModu
return;
}

if (!file.Content.Contains("ThemeModule"))
{
return;
}

file.NormalizeLineEndings();

var lines = file.GetLines().ToList();
Expand All @@ -630,7 +635,7 @@ private static void AddNamespaces(ProjectBuildContext context, string targetModu
{
lines.AddFirst(@namespace);
}

file.SetLines(lines);
}

Expand All @@ -641,7 +646,7 @@ private static void ChangeThemeToBasicForMvcProjects(ProjectBuildContext context
".Web", ".AuthServer", ".Web.Public", ".Web.Public.Host",
"" //for app-nolayers-mvc
};

if(!context.Symbols.Contains("tiered"))
{
projectNames.Add(".HttpApi.Host");
Expand Down Expand Up @@ -716,7 +721,7 @@ private static void ChangeThemeToBasicForBlazorServerProjects(ProjectBuildContex
context,
$"_Host.cshtml",
$"{defaultThemeName}Theme.Components",
"BasicTheme.Themes.Basic"
"BasicTheme.Themes.Basic"
);

ReplaceAllKeywords(
Expand Down

0 comments on commit dcf093f

Please sign in to comment.