/// <summary> /// Builds the required CodeSettings class needed for the Ajax Minifier. /// </summary> /// <returns></returns> private CodeSettings CreateCodeSettings() { var codeSettings = new CodeSettings(); codeSettings.MinifyCode = false; codeSettings.OutputMode = (this.RemoveWhitespace ? OutputMode.SingleLine : OutputMode.MultipleLines); // MinifyCode needs to be set to true in order for anything besides whitespace removal // to be done on a script. codeSettings.MinifyCode = this.ShouldMinifyCode; if (this.ShouldMinifyCode) { switch (this.VariableMinification) { case Core.Web.Scripting.VariableMinification.None: codeSettings.LocalRenaming = LocalRenaming.KeepAll; break; case Core.Web.Scripting.VariableMinification.LocalVariablesOnly: codeSettings.LocalRenaming = LocalRenaming.KeepLocalizationVars; break; case Core.Web.Scripting.VariableMinification.LocalVariablesAndFunctionArguments: codeSettings.LocalRenaming = LocalRenaming.CrunchAll; break; } // This is being set by default. A lot of scripts use eval to parse out various functions // and objects. These names need to be kept consistant with the actual arguments. codeSettings.EvalTreatment = EvalTreatment.MakeAllSafe; // This makes sure that function names on objects are kept exactly as they are. This is // so functions that other non-minified scripts rely on do not get renamed. codeSettings.PreserveFunctionNames = this.PreserveFunctionNames; } return codeSettings; }
/// <summary> /// Builds the required CodeSettings class needed for the Ajax Minifier. /// </summary> /// <returns></returns> private CodeSettings CreateCodeSettings() { var codeSettings = new CodeSettings(); codeSettings.MinifyCode = false; // MinifyCode needs to be set to true in order for anything besides whitespace removal // to be done on a script. codeSettings.MinifyCode = this.ShouldMinifyCode; return codeSettings; }