Type CompileView(string viewPath, IEnumerable <string> fullJsPaths, IEnumerable <string> fullCssPaths, IEnumerable <string> fullViewPaths) { log.Debug($"CompileView {viewPath} - JS Files: {JsonConvert.SerializeObject(fullJsPaths)} - CSS Files: {JsonConvert.SerializeObject(fullCssPaths)} - ViewFiles: {JsonConvert.SerializeObject(fullViewPaths)}"); var builder = new StringBuilder(); this.AppendHtml(fullViewPaths, builder); this.AppendJavascript(fullJsPaths, builder); // assumes viewPath is of the form "~/areas/{areaName}/path.cshtml var areaName = viewPath.Substring(8, viewPath.IndexOf("/", 8) - 8); this.AppendCss(fullCssPaths, areaName, builder); var viewCompilationData = new RazorViewCompilationData { Namespace = Path.GetDirectoryName(viewPath.Substring(2)).Replace("\\", ".").Replace("/", "."), ClassName = RazorViewCompiler.GetSafeClassName(Path.GetFileName(viewPath)), FilePath = viewPath, ViewContents = builder.ToString() }; var compiled = this.compiler.CompileFile(viewCompilationData); return(compiled); }
Type CompileView(string viewPath, IEnumerable <string> fullJsPaths, IEnumerable <string> fullLessPaths, IEnumerable <string> fullViewPaths, string fullViewPath) { var builder = new StringBuilder(); this.AppendHtml(fullViewPaths, builder); this.AppendJavascript(fullJsPaths, builder); // assumes viewPath is of the form "~/areas/{areaName}/path.cshtml var areaName = viewPath.Substring(8, viewPath.IndexOf("/", 8) - 8); this.AppendCss(fullLessPaths, areaName, builder); var viewCompilationData = new RazorViewCompilationData { Name = RazorViewCompiler.GetTypeName(viewPath.Substring(2)), ViewContents = builder.ToString() }; var compiled = this.compiler.CompileFile(viewCompilationData, new Assembly[0], true, fullViewPath); return(compiled); }