Example #1
0
 public Func <Stream> Transform(Func <Stream> openSourceStream, IAsset asset)
 {
     return(delegate
     {
         var id = idStrategy.HtmlTemplateId(bundle, asset);
         var template = openSourceStream().ReadToEnd();
         return string.Format("jQuery.template('{0}', {1});{2}", id, template, Environment.NewLine).AsStream();
     });
 }
Example #2
0
        public Func <Stream> Transform(Func <Stream> openSourceStream, IAsset asset)
        {
            return(delegate
            {
                var compiledTemplate = openSourceStream().ReadToEnd();

                var id = idStrategy.HtmlTemplateId(bundle, asset);
                var template = javaScriptVariableName + "['" + id + "']";

                var output = template + "=new Hogan.Template();" +
                             template + ".r=" + compiledTemplate + ";";
                return output.AsStream();
            });
        }
 public Func <Stream> Transform(Func <Stream> openSourceStream, IAsset asset)
 {
     return(delegate
     {
         var template = openSourceStream().ReadToEnd();
         var scriptElement = String.Format(
             "<script id=\"{0}\" type=\"{1}\"{2}>{3}</script>",
             idStrategy.HtmlTemplateId(bundle, asset),
             bundle.ContentType,
             bundle.HtmlAttributes.CombinedAttributes,
             template
             );
         return scriptElement.AsStream();
     });
 }
 string TemplateId(IAsset asset)
 {
     return(idStrategy.HtmlTemplateId(bundle, asset));
 }