Skip to content

Commit

Permalink
Implemented suggestions per Nicolas code review
Browse files Browse the repository at this point in the history
  • Loading branch information
rockstardev committed Sep 12, 2019
1 parent 7d7c1d8 commit 1157284
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/BundlerMinifier.Core/Bundle/BundleFileProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ private bool ProcessBundle(string baseFolder, Bundle bundle)
}

MinificationResult minResult = null;
var minFile = BundleMinifier.GetMinFileName(bundle.GetAbsoluteOutputFile());
if (bundle.IsMinificationEnabled)
{
var minFile = BundleMinifier.GetMinFileName(bundle.GetAbsoluteOutputFile());
var outputWriteTime = File.GetLastWriteTimeUtc(minFile);
var minifyChanged = bundle.MostRecentWrite >= outputWriteTime;

Expand All @@ -140,7 +140,7 @@ private bool ProcessBundle(string baseFolder, Bundle bundle)
File.SetLastWriteTimeUtc(minFile, DateTime.UtcNow);
changed |= minResult.Changed;

if (bundle.IsMinificationEnabled && bundle.SourceMap && !string.IsNullOrEmpty(minResult.SourceMap))
if (bundle.SourceMap && !string.IsNullOrEmpty(minResult.SourceMap))
{
string mapFile = minFile + ".map";
bool smChanges = FileHelpers.HasFileContentChanged(mapFile, minResult.SourceMap);
Expand All @@ -159,8 +159,7 @@ private bool ProcessBundle(string baseFolder, Bundle bundle)
if (bundle.IsGzipEnabled)
{
var fileToGzip = bundle.IsMinificationEnabled ?
BundleMinifier.GetMinFileName(bundle.GetAbsoluteOutputFile()) :
bundle.GetAbsoluteOutputFile();
minFile : bundle.GetAbsoluteOutputFile();

if (minResult == null)
BundleMinifier.GzipFile(fileToGzip, bundle, false, File.ReadAllText(fileToGzip));
Expand Down

0 comments on commit 1157284

Please sign in to comment.