MiniME.Compiler.CompileToString C# (CSharp) Méthode

CompileToString() public méthode

public CompileToString ( ) : string
Résultat string
        public string CompileToString()
        {
            if (MinifyKind == MinifyKind.CSS)
            {
                return CompileCssToString();
            }
            else
            {
                return CompileJavascriptToString();
            }
        }

Usage Example

Exemple #1
0
        private void RunTest(string resourceName)
        {
            var t = new TestFile();
            t.LoadFromString(LoadTextResource(resourceName));

            // Compile the input script
            var c = new Compiler();
            c.Formatted = t.Input.IndexOf("[Formatted]") >= 0;
            c.NoObfuscate = t.Input.IndexOf("[NoObfuscate]") >= 0;
            c.SymbolInfo = t.Input.IndexOf("[SymbolInfo]") >= 0;
            c.MinifyKind = t.Input.IndexOf("[CSS]") >= 0 ? MinifyKind.CSS : MinifyKind.JS;
            c.NoCredit = true;
            c.MaxLineLength = 0;
            c.AddScript(resourceName, t.Input, false);

            // Render it
            string strActual = c.CompileToString().Trim();

              //string sep = new string('-', 15);
              //Console.WriteLine(sep + " input " + sep + "\n" + t.Input);
              //Console.WriteLine(sep + " actual " + sep + "\n" + strActual);
              //Console.WriteLine(sep + " expected" + sep + "\n" + t.Output);

            Assert.That(strActual, Is.EqualTo(t.Output));
        }