Exemple #1
0
        public void TestMethod1()
        {
            string rootPath = @"C:\Users\justbe\Dropbox\Code\OrangeBits\Demo\";
            string inPath = rootPath + @"importTest.less";
            string outPath = rootPath + @"importTest.css";

            LessEngine engine = new LessEngine();
            SetCurrentFilePath(engine.Parser, inPath);

            var fileReader = new FileReader();
            var source = fileReader.GetFileContents(inPath);
            var css = engine.TransformToCss(source, inPath);
        }
Exemple #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="inPath"></param>
 /// <param name="outPath"></param>
 public CompileResults Compile(string inPath, string outPath)
 {
     using (StreamReader sr = new StreamReader(inPath))
     {
         LessEngine engine = new LessEngine();
         SetCurrentFilePath(engine.Parser, inPath);
         var fileReader = new FileReader();
         var source = fileReader.GetFileContents(inPath);
         var output = engine.TransformToCss(source, inPath);
         if (engine.LastTransformationSuccessful)
         {
             using (StreamWriter sw = new StreamWriter(outPath))
             {
                 sw.WriteLine(OrangeBits.GetHeader(inPath));
                 sw.Write(output);
             }
         }
         else
         {
             throw new Exception("Error compiling LESS");
         }
     }
     return null;
 }