public ICssMinifier CreateMinifier(string minifierName) { #if DNXCORE50 ICssMinifier minifier = new KristensenCssMinifier(); #else ICssMinifier minifier; switch (minifierName) { case "KristensenCssMinifier": minifier = new KristensenCssMinifier(); break; case "MsAjaxCssMinifier": minifier = new MsAjaxCssMinifier(); break; case "YuiCssMinifier": minifier = new YuiCssMinifier(); break; default: throw new NotSupportedException(); } #endif return(minifier); }
public ICssMinifier CreateMinifier(string minifierName) { ICssMinifier minifier; switch (minifierName) { case "KristensenCssMinifier": minifier = new KristensenCssMinifier(); break; #if !NETSTANDARD1_6 case "MsAjaxCssMinifier": minifier = new MsAjaxCssMinifier(); break; case "YuiCssMinifier": minifier = new YuiCssMinifier(); break; #endif case "NUglifyCssMinifier": minifier = new NUglifyCssMinifier(); break; default: throw new NotSupportedException(); } return(minifier); }
public HtmlHelper(string theme, string title) { //Read theme file and minify the CSS var ycm = new YuiCssMinifier(); var themeFile = File.ReadAllLines(String.Format(@"{0}\Assets\Themes\{1}.css", Environment.CurrentDirectory, theme)); var minified = ycm.Minify(String.Join("", themeFile), false); string themeCss; if (minified.Errors.Count == 0) themeCss = minified.MinifiedContent; else throw new FormatException("Unable to minify the provided CSS" + Environment.NewLine + String.Join("", minified.Errors)); //Read the main.js file and minify the javascript var jsm = new YuiJsMinifier(); var jsFile = File.ReadAllLines(String.Format(@"{0}\Assets\main.js", Environment.CurrentDirectory)); var minJs = jsm.Minify(String.Join("", jsFile), false); string mainJs = ""; if (minJs.Errors.Count == 0) mainJs = minJs.MinifiedContent; BaseTemplate = LoadHtml(@"Assets\base.html", new TupleList<string, string> { {"{{CSS}}", themeCss}, {"{{JAVASCRIPT}}", mainJs}, {"{{TITLE}}", title}, {"{{DATE}}", DateTime.Now.ToString("dd-MM-yyyy HH:mm")} }); TableTemplate = LoadHtml(@"Assets\table.html"); MetaDataTemplate = LoadHtml(@"Assets\metadata.html"); }