/// <summary> /// Init Google Closure Compiler (JavaScript) /// </summary> /// <param name="compiler"></param> /// <param name="compilerOptions"></param> /// <param name="compilationLevel">"WHITESPACE_ONLY" | "SIMPLE_OPTIMIZATIONS" | "ADVANCED_OPTIMIZATIONS"</param> private void MinifyInit(ref Compiler compiler, ref CompilerOptions compilerOptions, string compilationLevel) { try { compiler = new Compiler(); compiler.disableThreads(); Compiler.setLoggingLevel(Level.OFF); compilerOptions = new CompilerOptions(); compilerOptions.setLineBreak(false); compilerOptions.setLineLengthThreshold(524288); switch (compilationLevel) { case "WHITESPACE_ONLY": com.google.javascript.jscomp.CompilationLevel.WHITESPACE_ONLY.setOptionsForCompilationLevel(compilerOptions); break; case "SIMPLE_OPTIMIZATIONS": com.google.javascript.jscomp.CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel(compilerOptions); break; case "ADVANCED_OPTIMIZATIONS": com.google.javascript.jscomp.CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(compilerOptions); break; default: com.google.javascript.jscomp.CompilationLevel.WHITESPACE_ONLY.setOptionsForCompilationLevel(compilerOptions); break; } WarningLevel.DEFAULT.setOptionsForWarningLevel(compilerOptions); } catch (Exception) { } }