Пример #1
0
        public void Compress()
        {
            switch (InputFile.Substring(InputFile.LastIndexOf(".")).ToLower())
            {
                case ".aspx":
                case ".ascx":
                case ".master":
                case ".htm":
                case ".html":

                    AspxStringCompressor sc = new AspxStringCompressor();
                    this.OutputText = sc.Compress(this.InputText);
                    IsCompressed = true;
                    break;

                case ".js":
                    JavaScriptMinifier jsmin = new JavaScriptMinifier();
                    this.OutputText = jsmin.Minify(this.InputText);
                    IsCompressed = true;
                    break;

                case ".css":
                    this.OutputText = CssCompressor.Compress(this.InputText);
                    IsCompressed = true;
                    break;

                default:
                    IsCompressed = false;
                    break;
            }
        }
 private string JavaScriptShrinker(Match m)
 {
     JavaScriptMinifier jsmin = new JavaScriptMinifier();
     return m.Groups[1].Value + jsmin.Minify(m.Groups[2].Value) + m.Groups[3].Value;
 }