public YuiCompressorTransform(CompressorConfig compressorConfig) { if (compressorConfig == null) { throw new ArgumentNullException("compressorConfig"); } _compressorConfig = compressorConfig; }
private ICompressor DetermineCompressor(CompressorConfig compressorConfig) { if (compressorConfig == null) { throw new ArgumentNullException("compressorConfig"); } // Define the compressor we wish to use. ICompressor compressor; var config = _compressorConfig as CssCompressorConfig; if (config != null) { var cssCompressorConfig = config; compressor = new CssCompressor { CompressionType = cssCompressorConfig.CompressionType, LineBreakPosition = cssCompressorConfig.LineBreakPosition, RemoveComments = cssCompressorConfig.RemoveComments }; } else if (_compressorConfig is JavaScriptCompressorConfig) { var jsCompressorConfig = (JavaScriptCompressorConfig)_compressorConfig; compressor = new JavaScriptCompressor { CompressionType = jsCompressorConfig.CompressionType, DisableOptimizations = jsCompressorConfig.DisableOptimizations, Encoding = jsCompressorConfig.Encoding, ErrorReporter = jsCompressorConfig.ErrorReporter, IgnoreEval = jsCompressorConfig.IgnoreEval, LineBreakPosition = jsCompressorConfig.LineBreakPosition, LoggingType = jsCompressorConfig.LoggingType, ObfuscateJavascript = jsCompressorConfig.ObfuscateJavascript, PreserveAllSemicolons = jsCompressorConfig.PreserveAllSemicolons, ThreadCulture = jsCompressorConfig.ThreadCulture }; } else { throw new InvalidOperationException("Unhandled CompressorConfig instance while trying to initialize internal compressor properties."); } return(compressor); }
private ICompressor DetermineCompressor(CompressorConfig compressorConfig) { if (compressorConfig == null) { throw new ArgumentNullException("compressorConfig"); } // Define the compressor we wish to use. ICompressor compressor; var config = _compressorConfig as CssCompressorConfig; if (config != null) { var cssCompressorConfig = config; compressor = new CssCompressor { CompressionType = cssCompressorConfig.CompressionType, LineBreakPosition = cssCompressorConfig.LineBreakPosition, RemoveComments = cssCompressorConfig.RemoveComments }; } else if (_compressorConfig is JavaScriptCompressorConfig) { var jsCompressorConfig = (JavaScriptCompressorConfig)_compressorConfig; compressor = new JavaScriptCompressor { CompressionType = jsCompressorConfig.CompressionType, DisableOptimizations = jsCompressorConfig.DisableOptimizations, Encoding = jsCompressorConfig.Encoding, ErrorReporter = jsCompressorConfig.ErrorReporter, IgnoreEval = jsCompressorConfig.IgnoreEval, LineBreakPosition = jsCompressorConfig.LineBreakPosition, LoggingType = jsCompressorConfig.LoggingType, ObfuscateJavascript = jsCompressorConfig.ObfuscateJavascript, PreserveAllSemicolons = jsCompressorConfig.PreserveAllSemicolons, ThreadCulture = jsCompressorConfig.ThreadCulture }; } else { throw new InvalidOperationException("Unhandled CompressorConfig instance while trying to initialize internal compressor properties."); } return compressor; }