templates
Templates
Here is an image comes form art-template.
Mustache
Download it from CDN.
- +1, Tiny size (9.3KB, 3.5KB for gzip), you can use micromustache for more tiny size.
- -1, Don’t Support index in loop, you have to do like this to get index in an array.
Handlebars
Download it from CDN.
- +1, Extensibility
- +1, Flexible
- -1, Size with compiler is 73KB, 25KB for gzip size.
- -1, Runtime only size is 16.5KB, 6.1KB for gzip size.
doT
Download it from CDN.
- +1, Tiny size (3.3KB & 2.0KB for gzip size)
hogan
Product by twitter, hogan.js, 8.4KB, 4.2KB for gzip size.
Best Practices
One page include multiple templates, fetch templates and fetch page data should be processing together. First view on page should be compiled & included by server.
One component should do as less as possible logical process with another component. Most important thing is that component’s custom logic should be configured.
Comments
Leave a comment