static IEnumerable<IEnumerable<string>> htmlNewEA(ConfigLow cfg) { yield return Consts.htmlJsLib; if (cfg.target == Targets.web) yield return Consts.htmlLogin; if (cfg.target == Targets.web) yield return Consts.htmlAdmin; yield return Consts.htmlCourse; yield return Consts.htmlSchool; }
//Files z q:\LMCom\rew\Web4\JsLib\EA\img\, q:\LMCom\rew\Web4\JsLib\css\img\, Schools\EAImgMp3\framework\controls\symbols, static IEnumerable<IEnumerable<string>> cssBitmaps(ConfigLow cfg) { yield return new string[] { @"JsLib\EA\img", @"JsLib\css\img", @"Schools\EAImgMp3\framework\controls\symbols", /*@"BS3\fonts\",*/ @"font-awesome\font\" }. Select(pth => Directory.CreateDirectory(basicPath + pth)). SelectMany(d => d.EnumerateFiles().Select(f => f.DirectoryName.Substring(basicPath.Length) + "\\" + f.Name)); }
static IEnumerable<IEnumerable<string>> cssIE7(ConfigLow cfg) { switch (cfg.version) { case versions.debug: yield return Consts.cssBootstrapIE7; break; case versions.minified: case versions.not_minified: yield return new string[] { cssMinifiedIE7 + (cfg.version == versions.minified ? ".min" : null) + ".css" }; break; } }
static IEnumerable<IEnumerable<string>> cssNewEA(ConfigLow cfg) { switch (cfg.version) { case versions.debug: yield return Consts.cssBootstrap; yield return Consts.cssFontAwesome; yield return Consts.cssEA; yield return Consts.cssJsLib; if (cfg.target == Targets.web) yield return Consts.cssLogin; if (cfg.target == Targets.web) yield return Consts.cssAdmin; yield return Consts.cssCourse; yield return Consts.cssSchool; break; case versions.minified: case versions.not_minified: yield return cssMinifiedEx[cfg.target].Select(m => m + (cfg.version == versions.minified ? ".min" : null) + ".css"); break; } }
static IEnumerable<IEnumerable<string>> jsNewEA(ConfigLow cfg) { switch (cfg.version) { case versions.debug: yield return Consts.jsExternal; yield return Consts.jsModel; if (cfg.target == Targets.web) yield return Consts.jsLogin; if (cfg.target == Targets.web) yield return Consts.jsAdmin; if (cfg.target == Targets.scorm) yield return Consts.jsScorm; yield return Consts.jsCourse; yield return Consts.jsSchool; yield return Consts.jsEA; break; case versions.minified: case versions.not_minified: yield return jsMinifiedEx[cfg.target].Select(m => m + (cfg.version == versions.minified ? ".min" : null) + ".js"); break; } }
static void cssMinify(ConfigLow cfg, string resultFn, params string[][] groups) { StringBuilder sb = new StringBuilder(); foreach (var fn in groups.Where(g => g != null).SelectMany(g => g)) sb.AppendLine(File.ReadAllText(basicPath + fn)); writeFile(basicPath + resultFn + ".css", sb.ToString()); var comp = new CssCompressor().Compress(sb.ToString()); writeFile(basicPath + resultFn + ".min.css", comp); }
static void jsMinify(ConfigLow cfg, string resultFn, StringBuilder err, params string[][] groups) { StringBuilder sb = new StringBuilder(); foreach (var fn in groups.Where(g => g != null).SelectMany(g => g)) sb.AppendLine(File.ReadAllText(basicPath + fn)); writeFile(basicPath + resultFn + ".js", sb.ToString()); var comp = new JavaScriptCompressor() { ErrorReporter = new JSErrorReporter(resultFn, err) }.Compress(sb.ToString()); writeFile(basicPath + resultFn + ".min.js", comp); }
//Common files: CSS, JS, CSS bitmaps static IEnumerable<Consts.file> commonFiles(ConfigLow cfg) { return cssNewEA(cfg).Concat(jsNewEA(cfg)).Concat(cssBitmaps(cfg)).SelectMany(s => s).Select(fn => new Consts.file(fn)); }
static string langInclude(ConfigLow cfg) { //Include lang JS souboru do home stranky if (cfg.target == Targets.web) { return cfg.lang == null ? null : string.Format(cLangFiles, cfg.langStr); } return string.Format(cLangFiles, "{#lang}"); }