static void Main(string[] args) { if(args.Length <2) { Console.WriteLine("Input and output files required"); return; } var engine = new Engine(File.ReadAllText(args[0]), Console.Out); var path = args[1]; if (!File.Exists(path)) using(File.Create(path)){} using (var file = File.OpenWrite(path)){ var bytes = Encoding.ASCII.GetBytes(engine.Parse().Css); file.Write(bytes, 0, bytes.Length); } }
public void Can_Parse() { var engine = new Engine(File.ReadAllText(@"TestData/EngineRoom.less"), Console.Out); Console.Write(engine.Parse().Css); }
/// <summary> /// import : ws '@import' S import_url medias? s ';' ; /// </summary> /// <param name="node"></param> /// <param name="element"></param> private void Import(PegNode node, Element element) { var path = node.GetAsString(Src); if(node.child_ != null){ path = node.child_.GetAsString(Src); } path = path.Replace("\"", "").Replace("'", ""); //TODO: F**k around with pah to make it absolute relative if(HttpContext.Current!=null) { path = HttpContext.Current.Server.MapPath(path); } if(File.Exists(path)) { var engine = new Engine(File.ReadAllText(path), null); element.Rules.AddRange(engine.Parse().Root.Rules); } }