At Mad Mimi I created an extension to Template which looks something like 
this:

Template.from = function(id) {
  if(!$(id)) {
    console.warn("Missing template for " + id);
  } else {
    return new Template($(id).innerHTML.replace(/%23%7B(.*)%7D/g, "#{$1}"));
  }
};

Then in your HTML you'd have script blocks that look something like this:

<script id="my_template" type="text/template">
  This is a #{template}.
</script>

And in your JS you'd simply go:

Template.from('my_template').evaluate({ template: "Template in my HTML 
where it should be" });

-- Marc

On Monday, November 26, 2012 5:57:27 PM UTC+2, kstubs wrote:
>
> Agreed!  I'm not too keen on this idea but have been searching for a 
> solution to better encapsulate my code and assets.  I do not consider domo 
> the answer, but was an interesting idea.
> Something we are doing in prototype with the Template class does put HTML 
> markup directly into the JS code.  I am trying to mediate this though by 
> collecting all of my template markup in a separate JS namespaced object. 
>  This is helping a lot.  And if you don't mind inline style markup in the 
> result, you can do the same thing, keep all of your style together in a 
> separate JS object.
>
> Karl..
>
>
>
> On Tuesday, November 20, 2012 2:53:18 AM UTC-7, Victor wrote:
>>
>> Domo
>>
>>> http://domo-js.com/
>>
>>
>> From the J2EE developer's point of view it looks like return back to 
>> 2000s, to Servlets and tons of HTML/CSS markup in code. IMHO all advanced 
>> Java developers agree that moving HTML markup from Java code into separate 
>> JSP files was great step forward.
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/prototype-scriptaculous/-/bBsjG76ML9gJ.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to