From 11e2e84cf105b6b8ace185152793364ce1cea842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Jasica?= Date: Thu, 11 Apr 2019 16:54:11 +0200 Subject: [PATCH] Performance improvement- class.js is generated only once. --- .../Reporting/Builders/Rendering/HtmlRenderer.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ReportGenerator.Core/Reporting/Builders/Rendering/HtmlRenderer.cs b/src/ReportGenerator.Core/Reporting/Builders/Rendering/HtmlRenderer.cs index 8abd5b20..7b4be3a6 100644 --- a/src/ReportGenerator.Core/Reporting/Builders/Rendering/HtmlRenderer.cs +++ b/src/ReportGenerator.Core/Reporting/Builders/Rendering/HtmlRenderer.cs @@ -57,6 +57,11 @@ internal class HtmlRenderer : RendererBase, IReportRenderer, IDisposable /// private static readonly Dictionary FileNameByClass = new Dictionary(); + /// + /// Indicates that JavaScript was generated. + /// + private static bool javaScriptGenerated; + /// /// Indicates that only a summary report is created (no class reports). /// @@ -1082,9 +1087,10 @@ public void SaveClassReport(string targetDirectory, string assemblyName, string { this.SaveReport(); - if (!this.inlineCssAndJavaScript) + if (!this.inlineCssAndJavaScript && !javaScriptGenerated) { this.SaveJavaScript(targetDirectory); + javaScriptGenerated = true; } }