Ejemplo n.º 1
0
        private static void Compress(string filePath, string compressedFilePath)
        {
            var fileContent = File.ReadAllText(filePath);

            ICompressorFactory compressorFactory = new RazorCompressorFactory();
            BaseCompressor     compressor        = compressorFactory.CreateCompressor();

            fileContent = compressor.Compress(fileContent);

            WriteCompressedFile(fileContent, compressedFilePath);
        }
        private void RemoveWhiteSpaces(ActionExecutingContext filterContext)
        {
            var response = filterContext.HttpContext.Response;

            response.Filter = new WhiteSpaceFilter(response.Filter, s =>
            {
                ICompressorFactory compressorFactory = new HtmlCompressorFactory();
                BaseCompressor compressor            = compressorFactory.CreateCompressor();
                return(compressor.Compress(s));
            });
        }