diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs index 299e8f834e..41ff63468e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs @@ -11,6 +11,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling { public abstract class BundlerBase : IBundler, ITransientDependency { + private static string[] _minFileSuffixes = {"min", "prod"}; + public ILogger Logger { get; set; } protected IWebContentFileProvider WebContentFileProvider { get; } @@ -82,7 +84,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling { var fileContent = GetFileInfo(context, fileName).ReadAsString(); var nonMinifiedSize = fileContent.Length; - + Logger.LogDebug($"- {fileName} ({nonMinifiedSize} bytes) - non minified, minifying..."); fileContent = Minifier.Minify( @@ -110,14 +112,32 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling protected virtual bool IsMinFile(string fileName) { - return fileName.EndsWith($".min.{FileExtension}", StringComparison.InvariantCultureIgnoreCase); + foreach (var suffix in _minFileSuffixes) + { + if (fileName.EndsWith($".{suffix}.{FileExtension}", StringComparison.InvariantCultureIgnoreCase)) + { + return true; + } + } + + return false; } protected virtual IFileInfo GetMinFileInfoOrNull(string file) { - var fileInfo = WebContentFileProvider.GetFileInfo($"{file.RemovePostFix($".{FileExtension}")}.min.{FileExtension}"); + foreach (var suffix in _minFileSuffixes) + { + var fileInfo = WebContentFileProvider.GetFileInfo( + $"{file.RemovePostFix($".{FileExtension}")}.{suffix}.{FileExtension}" + ); + + if (fileInfo.Exists) + { + return fileInfo; + } + } - return fileInfo.Exists ? fileInfo : null; + return null; } protected virtual string ProcessBeforeAddingToTheBundle(IBundlerContext context, string filePath, string fileContent) @@ -125,4 +145,4 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling return fileContent; } } -} \ No newline at end of file +}