Пример #1
0
        public void MsMinifierTest()
        {
            var    javaScriptMinifier = MinifierRegistry.Get(MsMinifier.Identifier);
            string minifiedJavaScript = javaScriptMinifier.CompressContent(javaScript);

            Assert.AreEqual("function product(a,b){return a*b}function sum(a,b){return a+b}", minifiedJavaScript);
        }
Пример #2
0
        public void NullMinifierTest()
        {
            var    javaScriptMinifier = MinifierRegistry.Get(NullMinifier.Identifier);
            string minifiedJavaScript = javaScriptMinifier.CompressContent(javaScript);

            Assert.AreEqual(javaScript, minifiedJavaScript);
        }
Пример #3
0
        public void YuiMinifierTest()
        {
            var    javaScriptMinifier = MinifierRegistry.Get(YuiMinifier.Identifier);
            string minifiedJavaScript = javaScriptMinifier.CompressContent(javaScript);

            Assert.AreEqual("function product(c,d){return c*d}function sum(c,d){return c+d};", minifiedJavaScript);
        }
Пример #4
0
        private IJavaScriptMinifier MapMinifierEnumToType(JavaScriptMinifiers javaScriptMinifier)
        {
            string minifier;

            switch (javaScriptMinifier)
            {
            case JavaScriptMinifiers.NullMinifier:
                minifier = NullMinifier.Identifier;
                break;

            case JavaScriptMinifiers.JsMin:
                minifier = JsMinMinifier.Identifier;
                break;

            case JavaScriptMinifiers.Closure:
                minifier = ClosureMinifier.Identifier;
                break;

            case JavaScriptMinifiers.Yui:
                minifier = YuiMinifier.Identifier;
                break;

            case JavaScriptMinifiers.Ms:
                minifier = MsMinifier.Identifier;
                break;

            default:
                minifier = MsMinifier.Identifier;
                break;
            }
            return(MinifierRegistry.Get(minifier));
        }
Пример #5
0
        public string MinifyJavaScript(List <string> files, string minifierType)
        {
            IJavaScriptCompressor minifier = MinifierRegistry.Get(minifierType);

            return(MinifyJavaScript(files, minifier).ToString());
        }