0.5.3 • Published 1 year ago

smallstache v0.5.3

Weekly downloads
2
License
MIT
Repository
github
Last release
1 year ago

Smallstache

Build Status Test Coverage Code Climate

A lightweight, logic-less JavaScript template engine similar to Mustache/Handlebars. And look mummy, it has only 0.5kB minimized!

Features

  • Object-oriented approach
  • Very small footprint
  • No dependencies (only good old VanillaJS)
  • Fast and reliable (100% test coverage)
  • Easily debuggable (leaves original tag if can't find data)

Usage

Typical usage:

  var template = new Smallstache('Hello {{ something }}!');
  template.fill({something: 'World'});
  // > 'Hello World!'

You can also use an array as a data source:

  var title = new Smallstache('{{0}}, {{1}} and {{2}}');
  title.fill(['Me', 'Myself', 'I']);
  // > 'Me, Myself and I'

Or even a string!

  var question = new Smallstache('Food with 5 letters: {{0}}...{{4}}');
  question.fill('kebab');
  // > 'Food with 5 letters: k...b'

More examples of using Smallstache (with node and web browser) you can find in examples directory.

API

  • new Smallstache(string)

    Creates template object from given string.

  • .fill(obj): string

    Returns a string with template filled by an object, an array or a string.

License

MIT

0.5.3

1 year ago

0.5.2

2 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.6

6 years ago

0.4.5

8 years ago

0.4.4

8 years ago

0.4.3

8 years ago

0.4.2

8 years ago