SlideShare a Scribd company logo
1 of 27
Templating with your {{mustache}} (js)




                      Fronteers Jam Session - Oct, 5th 2011
Who




  And BEEEER
Rendering
Rendering
Rendering
Rendering



Expensive!
Rendering



Expensive!
Rendering



Expensive!



     Hard!
Rendering



Expensive!



     Hard!
Rendering



        Expensive!



             Hard!


Front
Rendering



           Expensive!



                Hard!


Front   Back
{{mustache}}




                                   what
Made by         Used by

                          etc...




Logic-less
Framework-agnostic
Shared templates (front/back end)
{{mustache}}




                                                       what
   Implementations for Javascript,
Ruby, Python, PHP, C++, Clojure,
Java, Scala etc...

  Simple!

  Fast!! Really fast!



                 ...but unfortunately not as fast as a neutrino
{{mustache}}




                                                       what
   Implementations for Javascript,
Ruby, Python, PHP, C++, Clojure,
Java, Scala etc...

  Simple!

  Fast!! Really fast!



                 ...but unfortunately not as fast as a neutrino
{{mustache}}




                                                            how
                 Simple! Really? Yes!


var user = {                                    {{tag}}
  first_name : “David”,
                          Object
  last_name : “Gilmour”
}
var tpl = “<p>Hello, {{first_name}} {{last_name}}!</p>” Template


var html = Mustache.to_html(tpl, user);      the magiccc



            “<p>Hello, David Gilmour!</p>”
{{mustache}}




                                                               how
                                                  {{#inStock}}
inStock : function(){ /*...*/ return true; }        ..render if true
                                                  {{/inStock}}


                                                   {{#guitars}}
guitars : [“ibanez”, “music man”, “gibson”]          {{.}}
                                                   {{/guitars}}


guitars : [{ name : “music man jpx”, strings:7}, ...]


                                              {{#guitars}}
                                                {{name}} {{strings}}
                   {{^guitars}}               {{/guitars}}
guitars : []         exactly! No guitars!
                   {{/guitars}}



to_unescape : “Me&You”      {{{to_unescape}}}
{{mustache}}




               how
  wait...
{{mustache}}




               how
  wait...
{{mustache}}




                        how
      wait...




...is it THAT simple?
{{mustache}}




                                           how
              wait...




  ...is it THAT simple?
Mustache.to_html(template, view,   partials)
{{mustache}}




                                                          how
              wait...




  ...is it THAT simple?
Mustache.to_html(template, view,     partials)
                 ...let’s take a look at some ‘real life’ examples
{{mustache}}


Fast! Really? Yes! Js is fast!




 data taken from “Mustache in the Front, Mustache in the Back” talk
         by Patrick Ewing - twitter developer - (@hoverbird)
{{mustache}}


                  Fast! Really? Yes! Js is fast!
Rendering time




                 HAML             ERB             {{rb}}          jQuery tpl             {{JS}}


                    data taken from “Mustache in the Front, Mustache in the Back” talk
                            by Patrick Ewing - twitter developer - (@hoverbird)
{{mustache}}


                  Fast! Really? Yes! Js is fast!
Rendering time




                 HAML             ERB             {{rb}}          jQuery tpl             {{JS}}


                    data taken from “Mustache in the Front, Mustache in the Back” talk
                            by Patrick Ewing - twitter developer - (@hoverbird)
{{mustache}}


                  Fast! Really? Yes! Js is fast!
Rendering time




                 HAML             ERB             {{rb}}          jQuery tpl             {{JS}}


                    data taken from “Mustache in the Front, Mustache in the Back” talk
                            by Patrick Ewing - twitter developer - (@hoverbird)
References




https://github.com/janl/mustache.js

https://github.com/stecb/mustachejs-examples
THANKS




@stecb

More Related Content

What's hot (9)

The Big Three
The Big ThreeThe Big Three
The Big Three
 
COSCUP: Foreign Function Call in Julia
COSCUP: Foreign Function Call in JuliaCOSCUP: Foreign Function Call in Julia
COSCUP: Foreign Function Call in Julia
 
深層学習とベイズ統計
深層学習とベイズ統計深層学習とベイズ統計
深層学習とベイズ統計
 
JavaScript Survival Guide
JavaScript Survival GuideJavaScript Survival Guide
JavaScript Survival Guide
 
Stateモナドの解説 前編
Stateモナドの解説 前編Stateモナドの解説 前編
Stateモナドの解説 前編
 
私は如何にして心配するのを止めてPyTorchを愛するようになったか
私は如何にして心配するのを止めてPyTorchを愛するようになったか私は如何にして心配するのを止めてPyTorchを愛するようになったか
私は如何にして心配するのを止めてPyTorchを愛するようになったか
 
JavaScript Patterns
JavaScript PatternsJavaScript Patterns
JavaScript Patterns
 
ベイジアンディープニューラルネット
ベイジアンディープニューラルネットベイジアンディープニューラルネット
ベイジアンディープニューラルネット
 
確率的プログラミングライブラリEdward
確率的プログラミングライブラリEdward確率的プログラミングライブラリEdward
確率的プログラミングライブラリEdward
 

Similar to Templating with your {{mustache}}js

AST Transformations
AST TransformationsAST Transformations
AST Transformations
HamletDRC
 
Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.
Peter Higgins
 

Similar to Templating with your {{mustache}}js (20)

NUS iOS Swift Talk
NUS iOS Swift TalkNUS iOS Swift Talk
NUS iOS Swift Talk
 
Building DSLs with Xtext - Eclipse Modeling Day 2009
Building DSLs with Xtext - Eclipse Modeling Day 2009Building DSLs with Xtext - Eclipse Modeling Day 2009
Building DSLs with Xtext - Eclipse Modeling Day 2009
 
AST Transformations
AST TransformationsAST Transformations
AST Transformations
 
ES6 - Level up your JavaScript Skills
ES6 - Level up your JavaScript SkillsES6 - Level up your JavaScript Skills
ES6 - Level up your JavaScript Skills
 
2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws
 
Avoiding JavaScript Pitfalls Through Tree Hugging
Avoiding JavaScript Pitfalls Through Tree HuggingAvoiding JavaScript Pitfalls Through Tree Hugging
Avoiding JavaScript Pitfalls Through Tree Hugging
 
JSON and the APInauts
JSON and the APInautsJSON and the APInauts
JSON and the APInauts
 
What's new in Perl 5.10?
What's new in Perl 5.10?What's new in Perl 5.10?
What's new in Perl 5.10?
 
03 introduction to graph databases
03   introduction to graph databases03   introduction to graph databases
03 introduction to graph databases
 
Pattern Matching: From Small Enhancement to Major Feature (talk from JavaLand...
Pattern Matching: From Small Enhancement to Major Feature (talk from JavaLand...Pattern Matching: From Small Enhancement to Major Feature (talk from JavaLand...
Pattern Matching: From Small Enhancement to Major Feature (talk from JavaLand...
 
Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.Your Library Sucks, and why you should use it.
Your Library Sucks, and why you should use it.
 
GraphQL
GraphQLGraphQL
GraphQL
 
Copy/paste detector for source code on javascript
Copy/paste detector for source code on javascript Copy/paste detector for source code on javascript
Copy/paste detector for source code on javascript
 
Hadoop Summit Europe 2014: Apache Storm Architecture
Hadoop Summit Europe 2014: Apache Storm ArchitectureHadoop Summit Europe 2014: Apache Storm Architecture
Hadoop Summit Europe 2014: Apache Storm Architecture
 
jRuby: The best of both worlds
jRuby: The best of both worldsjRuby: The best of both worlds
jRuby: The best of both worlds
 
Java 8: the good parts!
Java 8: the good parts!Java 8: the good parts!
Java 8: the good parts!
 
JavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsJavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good Parts
 
GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑
 
Dapper Tool - A Bundle to Make your ECL Neater
Dapper Tool - A Bundle to Make your ECL NeaterDapper Tool - A Bundle to Make your ECL Neater
Dapper Tool - A Bundle to Make your ECL Neater
 
Naïveté vs. Experience
Naïveté vs. ExperienceNaïveté vs. Experience
Naïveté vs. Experience
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 

Templating with your {{mustache}}js

  • 1. Templating with your {{mustache}} (js) Fronteers Jam Session - Oct, 5th 2011
  • 2. Who And BEEEER
  • 10. Rendering Expensive! Hard! Front
  • 11. Rendering Expensive! Hard! Front Back
  • 12. {{mustache}} what Made by Used by etc... Logic-less Framework-agnostic Shared templates (front/back end)
  • 13. {{mustache}} what Implementations for Javascript, Ruby, Python, PHP, C++, Clojure, Java, Scala etc... Simple! Fast!! Really fast! ...but unfortunately not as fast as a neutrino
  • 14. {{mustache}} what Implementations for Javascript, Ruby, Python, PHP, C++, Clojure, Java, Scala etc... Simple! Fast!! Really fast! ...but unfortunately not as fast as a neutrino
  • 15. {{mustache}} how Simple! Really? Yes! var user = { {{tag}} first_name : “David”, Object last_name : “Gilmour” } var tpl = “<p>Hello, {{first_name}} {{last_name}}!</p>” Template var html = Mustache.to_html(tpl, user); the magiccc “<p>Hello, David Gilmour!</p>”
  • 16. {{mustache}} how {{#inStock}} inStock : function(){ /*...*/ return true; } ..render if true {{/inStock}} {{#guitars}} guitars : [“ibanez”, “music man”, “gibson”] {{.}} {{/guitars}} guitars : [{ name : “music man jpx”, strings:7}, ...] {{#guitars}} {{name}} {{strings}} {{^guitars}} {{/guitars}} guitars : [] exactly! No guitars! {{/guitars}} to_unescape : “Me&You” {{{to_unescape}}}
  • 17. {{mustache}} how wait...
  • 18. {{mustache}} how wait...
  • 19. {{mustache}} how wait... ...is it THAT simple?
  • 20. {{mustache}} how wait... ...is it THAT simple? Mustache.to_html(template, view, partials)
  • 21. {{mustache}} how wait... ...is it THAT simple? Mustache.to_html(template, view, partials) ...let’s take a look at some ‘real life’ examples
  • 22. {{mustache}} Fast! Really? Yes! Js is fast! data taken from “Mustache in the Front, Mustache in the Back” talk by Patrick Ewing - twitter developer - (@hoverbird)
  • 23. {{mustache}} Fast! Really? Yes! Js is fast! Rendering time HAML ERB {{rb}} jQuery tpl {{JS}} data taken from “Mustache in the Front, Mustache in the Back” talk by Patrick Ewing - twitter developer - (@hoverbird)
  • 24. {{mustache}} Fast! Really? Yes! Js is fast! Rendering time HAML ERB {{rb}} jQuery tpl {{JS}} data taken from “Mustache in the Front, Mustache in the Back” talk by Patrick Ewing - twitter developer - (@hoverbird)
  • 25. {{mustache}} Fast! Really? Yes! Js is fast! Rendering time HAML ERB {{rb}} jQuery tpl {{JS}} data taken from “Mustache in the Front, Mustache in the Back” talk by Patrick Ewing - twitter developer - (@hoverbird)

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n