private static IHtmlString GenerateTemplates(string templatePath, string[] templateExtensions, ITemplateNamer templateNamer)
        {
            templatePath = HttpContext.Current.Request.MapPath(templatePath);
            var files = FindFiles(templatePath, templatePath, templateExtensions);

            return BuildTemplates(templatePath, files, templateNamer);
        }
 private static IHtmlString BuildTemplates(string templatePath, List<string> files, ITemplateNamer templateNamer)
 {
     var templates = new StringBuilder();
     foreach (var templateFile in files)
     {
         var pathDiff = FileToolkit.PathDifference(templateFile, templatePath);
         var templateName = templateNamer.GenerateName(pathDiff, Path.GetFileName(templateFile));
         templates.AppendFormat("<script type='text/x-handlebars' data-template-name='{0}'>\n", templateName);
         templates.AppendLine(File.ReadAllText(templateFile));
         templates.AppendLine("</script>");
     }
     return new HtmlString(templates.ToString());
 }
 public HandlebarsTransformer(ITemplateNamer templateNamer)
 {
     this.namer = templateNamer;
 }
 public HandlebarsTransformer()
 {
     namer = new TemplateNamer();
 }
 public static IHtmlString InjectRawTemplates(string templatePath, string[] templateExtensions, ITemplateNamer templateNamer)
 {
     return GenerateTemplates(templatePath, templateExtensions, templateNamer);
 }
        private static IHtmlString BuildTemplates(string templatePath, List <string> files, ITemplateNamer templateNamer)
        {
            var templates = new StringBuilder();

            foreach (var templateFile in files)
            {
                var pathDiff     = FileToolkit.PathDifference(templateFile, templatePath);
                var templateName = templateNamer.GenerateName(pathDiff, Path.GetFileName(templateFile));
                templates.AppendFormat("<script type='text/x-handlebars' data-template-name='{0}'>\n", templateName);
                templates.AppendLine(File.ReadAllText(templateFile));
                templates.AppendLine("</script>");
            }
            return(new HtmlString(templates.ToString()));
        }
        private static IHtmlString GenerateTemplates(string templatePath, string[] templateExtensions, ITemplateNamer templateNamer)
        {
            templatePath = HttpContext.Current.Request.MapPath(templatePath);
            var files = FindFiles(templatePath, templatePath, templateExtensions);

            return(BuildTemplates(templatePath, files, templateNamer));
        }
 public static IHtmlString InjectRawTemplates(string templatePath, string[] templateExtensions, ITemplateNamer templateNamer)
 {
     return(GenerateTemplates(templatePath, templateExtensions, templateNamer));
 }
 public HandlebarsTransformer(ITemplateNamer templateNamer)
 {
     this.namer = templateNamer;
 }
 public HandlebarsTransformer()
 {
     namer = new TemplateNamer();
 }