Created
April 5, 2011 23:40
-
-
Save thomasjo/904820 to your computer and use it in GitHub Desktop.
NOTE: This code sample is not great, but it works.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using Zippy.Chirp; | |
using Zippy.Chirp.Engines; | |
namespace Chirpy.ConsoleRedux | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var findPath = "."; | |
if (args.Length > 0) findPath = args[0]; | |
var cssEngine = new YuiCssEngine(); | |
var lessEngine = new LessEngine(); | |
foreach (var extension in lessEngine.Extensions) | |
{ | |
foreach (var filename in Directory.GetFiles(findPath, "*" + extension, SearchOption.AllDirectories)) | |
{ | |
if (filename.Contains(".min.")) continue; | |
var text = File.ReadAllText(filename); | |
text = lessEngine.Transform(filename, text, null); | |
var minFileName = Utilities.GetBaseFileName(filename, extension) + lessEngine.GetOutputExtension(filename); | |
File.WriteAllText(minFileName, text); | |
Console.WriteLine(string.Format("{0} -- {1}", lessEngine.GetType().Name, filename)); | |
var minText = cssEngine.Transform(minFileName, text, null); | |
minFileName = Utilities.GetBaseFileName(filename, extension) + cssEngine.GetOutputExtension(filename); | |
File.WriteAllText(minFileName, minText); | |
Console.WriteLine(string.Format("{0} -- {1}", cssEngine.GetType().Name, filename)); | |
} | |
} | |
//config file | |
var configEngine = new ConfigEngine(); | |
foreach (var filename in Directory.GetFiles(findPath, "*" + Settings.ChirpConfigFile, SearchOption.AllDirectories)) | |
{ | |
try | |
{ | |
Console.WriteLine(string.Format("ConfigEngine -- {0}", filename)); | |
configEngine.Run(filename, null); | |
} | |
catch (FileNotFoundException) | |
{ | |
Console.WriteLine(string.Format("File not found in config file={0}", filename)); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment