• This repository has been archived on 20/Aug/2020
  • Stars
    star
    454
  • Rank 96,373 (Top 2 %)
  • Language
    HTML
  • License
    MIT License
  • Created over 15 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simplest Templating Engine

NANO - Simplest Template Engine

Basic Usage

Assuming you have following JSON response:

data = {
  user: {
    login: "tomek",
    first_name: "Thomas",
    last_name: "Mazur",
    account: {
      status: "active",
      expires_at: "2009-12-31"
    }
  }
}

you can make:

nano("<p>Hello {user.first_name} {user.last_name}! Your account is <strong>{user.account.status}</strong></p>", data)

and you get ready string:

<p>Hello Thomas Mazur! Your account is <strong>active</strong></p>

Test page: testPage.html

Simple huh?

More Advanced Example

Displaying list of twitter search results (JSONP API)

http://jsfiddle.net/UXZDy/86/