Javascript Template Engine - Getting Started

789 views
598 views

Published on

An introduction to Javascript Template Engine

Published in: Technology, Business
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
789
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
27
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Javascript Template Engine - Getting Started

  1. 1. Javascript Template Engine Prabhakaran UX Developer, Reportbee Executive Member, RIA-RUI Society
  2. 2. Javascript Template Engine?
  3. 3. Javascript Template Engine? Output = Template( input, data )
  4. 4. Input Data Output
  5. 5. Why & When to use? • Decouple HTML and JS • Code maintainability • For large projects
  6. 6. Why & When to use? • • • • When you think you are JS Ninja When you need to work on your code again Good value for your resume Follow the trend
  7. 7. Client-side Templates • • • • • • • • • Mustache.js Handlebars.js EJS Underscore.js JsRender Hogan.js by Twitter Dust.js by Linkedin jQuery templates etc, etc…
  8. 8. Server-side Templates • Jade • Slim • etc, etc…
  9. 9. Templates Type • Logical templates • Logicless templates
  10. 10. Logical Templates
  11. 11. Logicless Templates
  12. 12. Choosing Right Template • • • • • • • Speed Logic or Logicless Pre-compilation Active development Community support File size Client or Server side
  13. 13. Mustache
  14. 14. Handlebars? • Has advanced features and can satisfy almost all kinds of requirement • Has most active community • Its a logicless templating engine • Lot of frameworks use Handlebars by default
  15. 15. Handlebars • • • • • Expressions Data or context Compiler Block helpers Partials
  16. 16. Expressions
  17. 17. Data
  18. 18. Compile
  19. 19. Block Helper
  20. 20. Get hands dirty ( Check sample.html )
  21. 21. @prabhakaran_v Karan.prabhu@gmail.com

×