public void RenderCss(TextWriter writer, CssResource css) { string cssFolder = AppCss.Current.CssFolder; var file = (FileCssResource)css; #if DEBUG string cssFilePath = file.DebugPath; #else string cssFilePath = file.MinPath; #endif writer.Write("<link href=\""); if (!cssFilePath.StartsWith("http") && !cssFilePath.StartsWith("/")) writer.Write(cssFolder); writer.Write(cssFilePath); writer.WriteLine("\" rel=stylesheet />"); }
public void RenderCssInline(TextWriter writer, CssResource css, bool includeStyleTags) { var file = (FileCssResource)css; #if DEBUG string webPath = file.DebugPath; #else string webPath = file.MinPath; #endif if (!webPath.StartsWith("http") && !webPath.StartsWith("/")) webPath = AppCss.Current.CssFolder + webPath; string filePath = HttpContext.Current.Server.MapPath("~" + webPath); var fileInfo = new FileInfo(filePath); if (includeStyleTags) writer.WriteLine("<style>"); using (StreamReader reader = fileInfo.OpenText()) { string line; while ((line = reader.ReadLine()) != null) writer.WriteLine(line); } if (includeStyleTags) writer.WriteLine("</style>"); }