Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add docs

  • Loading branch information...
commit 007c982087bda60632bfb08e5ba8214d618a39e3 1 parent 9688a96
TJ Holowaychuk authored

Showing 1 changed file with 38 additions and 1 deletion. Show diff stats Hide diff stats

  1. +38 1 Readme.md
39 Readme.md
Source Rendered
... ... @@ -1,7 +1,44 @@
1 1
2 2 # minstache
3 3
4   - Mini mustache template engine
  4 + Mini mustache template engine.
  5 +
  6 +## Installation
  7 +
  8 + $ npm install minstache
  9 +
  10 +## mm(1)
  11 +
  12 + The `mm(1)` executable (mini-mustache) can compile a file to a valid
  13 + stand-alone commonjs module for you, there's no need to have minstache
  14 + as a dependency:
  15 +
  16 + hello.mustache:
  17 +
  18 +```
  19 +Hello {{name}}!
  20 +```
  21 +
  22 + convert it:
  23 +
  24 +```
  25 +$ mm < hello.mustache > hello.js
  26 +```
  27 +
  28 + hello.js:
  29 +
  30 +```js
  31 +module.exports = function(obj) {
  32 + function escape(html) {
  33 + return String(html)
  34 + .replace(/&/g, '&amp;')
  35 + .replace(/"/g, '&quot;')
  36 + .replace(/</g, '&lt;')
  37 + .replace(/>/g, '&gt;');
  38 + };
  39 + return "Hello " + escape(obj.name) + "!"
  40 +};
  41 +```
5 42
6 43 ## License
7 44

0 comments on commit 007c982

Please sign in to comment.
Something went wrong with that request. Please try again.