Slide 1

Slide 1 text

Mustache Logic-less templates

Slide 2

Slide 2 text

@keithpitt Keith Pitt iOS/Web Developer The Frontier Group

Slide 3

Slide 3 text

What is Mustache? • Mustache is a logic-less templating system for HTML, config files, anything really • Lightweight • No if statements, else clauses, or for loops Text

Slide 4

Slide 4 text

Usage

Slide 5

Slide 5 text

* {{name}} * {{age}} * {{company}} * {{{company}}} * Keith * * <b>TFG</b> * TFG Tags { “name”: “Keith”, “company: “TFG” } + =

Slide 6

Slide 6 text

{{#repo}} {{name}} {{/repo}} rails redis Sections { “repo”: [ { “name”: “rails” }, { “name”: “redis” } ] } + =

Slide 7

Slide 7 text

{{^repo}} No Repos! {{/repo}} No Repos! Inverted Sections { “repo”: [ ] } + =

Slide 8

Slide 8 text

Repos {{! this is a comment }}

Comments

Slide 9

Slide 9 text

{{ < partial_name_here }} Partials

Slide 10

Slide 10 text

Support • Ruby • JavaScript • Python • Erlang • PHP • Perl • Objective-C • Java • .NET • Android • C++ • Go • LUA • ooc • ActionScript • CoffeeScript • ColdFusion • Scala • Clojure • Fantom • D • node.js

Slide 11

Slide 11 text

Ruby Example >> require 'mustache' => true >> Mustache.render("Hello {{planet}}", :planet => "World!") => "Hello World!"

Slide 12

Slide 12 text

Examples

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

@keithpitt Thanks for your attention