• Stars
    star
    826
  • Rank 52,876 (Top 2 %)
  • Language
    HTML
  • License
    MIT License
  • Created over 11 years ago
  • Updated 6 months ago

Reviews

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

Repository Details

A tiny javascript templating framework in ~400 bytes gzipped

t.js

A tiny javascript templating framework in ~400 bytes gzipped

t.js is a simple solution to interpolating values in an html string for insertion into the DOM via innerHTML.

Features

  • Simple interpolation: {{=value}}
  • Scrubbed interpolation: {{%unsafe_value}}
  • Name-spaced variables: {{=User.address.city}}
  • If/else blocks: {{value}} <<markup>> {{:value}} <<alternate markup>> {{/value}}
  • If not blocks: {{!value}} <<markup>> {{/!value}}
  • Object/Array iteration: {{@object_value}} {{=_key}}:{{=_val}} {{/@object_value}}
  • Multi-line templates (no removal of newlines required to render)
  • Render the same template multiple times with different data
  • Works in all modern browsers

How to use

var template = new t("<div>Hello {{=name}}</div>");
document.body.innerHtml = template.render({name: "World!"});

For more advanced usage check the t_test.html.

This software is released under the MIT license.


Coffeescript version maintained by @davidrekow

PHP version maintained by @ramon82

More Repositories

1

smlr

Re-encode jpeg images with no perceivable quality loss.
Go
433
star
2

lambda_proc

Running a companion process to an AWS Lambda function in go
Go
236
star
3

DumbledORM

A novelty PHP ORM
PHP
63
star
4

cryp

simple tools for encryption from the command-line
Go
26
star
5

geo

Simple go wrapper for Google Geocoder API
Go
16
star
6

go-butteraugli

a golang port of the butteraugli library
Go
16
star
7

cardinal

a circular buffer of sets
Go
12
star
8

skwurly

a urlsort function in c
C
10
star
9

eventin

nyt events api app
Go
6
star
10

dk

a decaying 2-dimensional hashtable of counters
Go
6
star
11

ghostmates

Postmates API library
Go
5
star
12

grate

a simple rate limiter
Go
5
star
13

funsafe

experimental package for bypassing package export rules in go
Go
4
star
14

buildbox

ubuntu precise64 vagrant build box
Shell
4
star
15

myne

Java
3
star
16

dirtsimplecolor

a dirt simple color picker for modern browsers
3
star
17

hist

cli tool for generating histograms
Go
3
star
18

helo

a discarding smtp/s server/library
Go
2
star
19

imagine

Go
2
star
20

pubdis

A simple pubsub app
JavaScript
2
star
21

oc

a sortable, iterable map of counters
Go
2
star
22

delta

cli tool for delta encoding/decoding
Go
2
star
23

acslater

a simple auth cache that expires
Go
1
star
24

rnd

playing with prngs
Go
1
star
25

wc

a faster wc
Go
1
star
26

terminal-dash

dashboard for the term
Go
1
star
27

bufcpy

variations on []byte copy functions with benchmarks
Go
1
star
28

mordor

adhoc port scan
Go
1
star
29

cdist

a utf8 rune distribution over stdin
Go
1
star
30

dk-server

trend/cardinality tracking server
Go
1
star
31

flk

a simple snowflake server for generating unique ids
Go
1
star
32

trex

a lexing trie
Go
1
star
33

stater

a lib to make stating your app easy
Go
1
star
34

glisten

go port of a HTML5 Canvas image generation algorithm
Go
1
star
35

dapper

ldap like a sir
Go
1
star
36

tunr

a puzzle game
JavaScript
1
star
37

tt

cli tool to calculate the difference, intersection, or union on newline delimited files
Go
1
star
38

bogl

quick hack at a boggle solver
Go
1
star
39

balance

Go
1
star
40

bytes2human

cli tool that converts bytes to human readable quantities
Go
1
star
41

delts

Delta tracking in streams
Go
1
star
42

pointer

Full example code from the article "Pointer arithmetic, (f)unsafe, and garbage collector behavior in go"
Go
1
star
43

json_tests

simple json throughput tests
Java
1
star
44

cog

a gearmand client/worker lib
Go
1
star