Skip to content

Commit

Permalink
Merge pull request #14053 from abpframework/EngincanV/cli-theme-logo
Browse files Browse the repository at this point in the history
CLI: Remove theme logo folder according to theme selection
  • Loading branch information
EngincanV authored Sep 19, 2022
2 parents 0ec0116 + c14863a commit c5c0f9f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps;

public class RemoveFilesStep : ProjectBuildPipelineStep
{
private readonly string _filePath;

public RemoveFilesStep(string filePath)
{
_filePath = filePath;
}

public override void Execute(ProjectBuildContext context)
{
context.Files.RemoveAll(file => file.Name.Contains(_filePath));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public override void Execute(ProjectBuildContext context)
file.Name.EndsWith(".ps1") ||
file.Name.EndsWith(".html") ||
file.Name.EndsWith(".ts") ||
file.Name.EndsWith(".scss"))
file.Name.EndsWith(".css"))
{
file.RemoveTemplateCode(context.Symbols);
file.RemoveTemplateCodeMarkers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ protected void ConfigureTheme(ProjectBuildContext context, List<ProjectBuildPipe
steps.Add(new ChangeThemeStyleStep());
}

RemoveThemeLogoFolders(context, steps);

if (IsDefaultThemeForTemplate(context.BuildArgs.Theme.Value))
{
return;
Expand All @@ -213,6 +215,19 @@ protected void ConfigureTheme(ProjectBuildContext context, List<ProjectBuildPipe
RemoveLeptonXThemePackagesFromPackageJsonFiles(steps, isProTemplate: IsPro(), uiFramework: context.BuildArgs.UiFramework);
}

private void RemoveThemeLogoFolders(ProjectBuildContext context, List<ProjectBuildPipelineStep> steps)
{
if (context.BuildArgs.Theme is not Theme.Lepton && IsPro())
{
steps.Add(new RemoveFilesStep("/wwwroot/images/logo/lepton"));
}

if (context.BuildArgs.Theme is not Theme.LeptonX or Theme.LeptonXLite)
{
steps.Add(new RemoveFilesStep("/wwwroot/images/logo/leptonx"));
}
}

private static bool IsDefaultThemeForTemplate(Theme theme)
{
var defaultThemesForTemplates = new[]
Expand Down

0 comments on commit c5c0f9f

Please sign in to comment.