public static string Minify(FileInfo file)
 {
     MemoryStream minified = new MemoryStream();
     JavaScriptMinifier minifier = new JavaScriptMinifier();
     minifier.Minify(file.FullName, minified);
     byte[] buffer = GetBytes(minified);
     minifier.Dispose();
     return Encoding.ASCII.GetString(buffer);
 }
示例#2
0
        public static string Minify(FileInfo file)
        {
            MemoryStream       minified = new MemoryStream();
            JavaScriptMinifier minifier = new JavaScriptMinifier();

            minifier.Minify(file.FullName, minified);
            byte[] buffer = GetBytes(minified);
            minifier.Dispose();
            return(Encoding.ASCII.GetString(buffer));
        }
        public static string Minify(Stream source)
        {
            JavaScriptMinifier minifier = new JavaScriptMinifier();
            MemoryStream minified = new MemoryStream();

            using(minifier.sr = new StreamReader(source))
            {
                minifier.sw = new StreamWriter(minified);
                minifier.jsmin();
            }
            byte[] buffer = GetBytes(minified);
            minifier.Dispose();
            return Encoding.ASCII.GetString(buffer);
        }
示例#4
0
        public static string Minify(Stream source)
        {
            JavaScriptMinifier minifier = new JavaScriptMinifier();
            MemoryStream       minified = new MemoryStream();

            using (minifier.sr = new StreamReader(source))
            {
                minifier.sw = new StreamWriter(minified);
                minifier.jsmin();
            }
            byte[] buffer = GetBytes(minified);
            minifier.Dispose();
            return(Encoding.ASCII.GetString(buffer));
        }