I was dubious when Twitter released Bootstrap.css, but i have to say, not being a UI expert i found it quite easy to work with. Concisely documented and the right set of tools that i need, for the most part at least. Some more on typography would have been nice.
I have yet to understand how templating engines work, and what advantages they provide, but knowing this comes from twitter piques my interest for the future.
One place that it really clicked for me in a real world situation was by looking at the source for NodeUp, a node.js podcast. http://nodeup.com/
It's a beautiful website, and I was curious what their HTML looked like. If you look at the source for the page, all you see is the mustache template that they then populate with the information for all of the podcasts that they've done. You then can start to see the power that templating gives you. Serve up a template in your html, request some JSON to populate it with on page load and have it replicated.
Makes your initial page very cacheable and clean. Much better than assembling html by hand with "foo" + "bar" or .append semantics.
Thanks for a detailed response. I checked out the link and saw Mustache in the source.
I still dont see (if im correct in thinking) how this de-duplicates effort?
They still have to do the work to construct the JSON, no?
PS. Not trying to be inflammatory, i'm just trying to understand this better but struggling to get my head around it. I just watched a templating video by the YUI team for Node.js and am still none the wiser. :(
It really decouples the model (the data that's served in the json) from the view (the mustache template). This lets frameworks like ember and backbone do MVC on the client side where the server is really just there to serve up a model (in the same way that a database does for most current apps).
Making an http request is then equivalent to making a sql query.
I've been working with Backbone and mustache and unfortunately I have to munge my models a lot to get the right results - like passing the cid or converting dates, etc. How do you work around this? I have thought of initializing many of these, but then I'd need to bind on changes... I guess you could save lambdas as attributes?
Yeah, you'll still need to jump through some hoops to get the data ready. Templates are useful when you have a JSON data source and a rather complex HTML UI that is built off the data on the fly after the page loads. You could totally build the HTML manually inside Javascript as well, but it gets time consuming for the developer, especially with Javascript's lack of long-format strings """like these in Python""".
If they're using Node (and I assume they are, based on the fact that it's a Node.js podcast), I don't really understand why they wouldn't render the HTML server side (I may be showing my age by asking this) instead of relying on the client to render it.
In practice there is usually a world of difference between apis that are used to build a service's main website and apis that are written outside of it. Forcing yourself to use your own apis is one of the absolute best ways to ensure you improve it.
Sounds like it doesn't really matter. They could do either. They might have done it on the client specifically for those people that want to see the code.
I have yet to understand how templating engines work, and what advantages they provide, but knowing this comes from twitter piques my interest for the future.