1.4.4 • Published 10 years ago

plate v1.4.4

Weekly downloads
50
License
MIT
Repository
-
Last release
10 years ago

Plate.js -- A Template Library

Plate is a Django Template Language implementation in Javascript. Super exciting!

Plate

  • Plays nicely with the event loop and async code. Plate makes it easy to parallelize your view code!
  • Aims to be compatible with the latest version of the Django Template Language. If you've got a template in Django, it should render just fine in Plate.
  • Thoroughly tested using tape.
  • Designed to work nicely in a Node.js environment
  • Extensible -- It makes use of plugins to provide capabilities (e.g., template loading).

Can I use it in my browser?

Yes. Plate was designed to work well in the standard suite of browsers. Each minor point release will target compatibility with IE7+, FF3+, Chrome, and Safari 4+.

You can download a minified, precompiled version here.

If you're having trouble, try using the debug version, with source maps.

How do I use it?

In node (or browserify):

    var plate = require('plate')

    var template = new plate.Template('hello {{ world }}')

    template.render({world:'everyone'}, function(err, data) {
      console.log(data)
    })

    // outputs "hello everyone"

Plate follows the Node.js style of taking callbacks that receive an error object and a data object. If there's no error, err will be null.

In browser (vanilla):

    <script type="text/javascript" src="plate.min.js">
    <script type="text/html" id="template">
        hello {{ world }}.
    </script>
    <script type="text/javascript">
        var source = $('#template').text()
          , template = new plate.Template(source)

        template.render({world: 'everyone'}, function(err, data) {
          console.log(data)
        })
    </script>

In browser (using require.js):

require(['plate.min'], function(plate) {
  var template = new plate.Template('hello {{ world }}')
})

Documentation

Plate is documented on its github wiki. There are "Getting Started" guides for both in-browser as well as in-node environments.

Contributing

Got a feature you'd like to add? I'd love to see it. The workflow is pretty standard Github fare:

  • Fork this repository.
  • Create a branch -- title it descriptively, please :)
  • Work, work, work.
  • Push your changes and submit a pull request.

The minimum requirements for a pull request to be merged are:

  • You've added (passing) tests for your new code.
  • The existing tests still pass.
  • You've added (or changed, as appropriate) documentation to the docs/ folder in Markdown format.

Run the tests

In node:

$ npm install plate
$ npm test plate

License

Licensed MIT.

1.4.4

10 years ago

1.4.3

10 years ago

1.4.2

10 years ago

1.4.1

10 years ago

1.4.0

10 years ago

1.3.0

11 years ago

1.2.0

11 years ago

1.1.2

11 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.9

11 years ago

1.0.8

11 years ago

1.0.7

11 years ago

1.0.6

11 years ago

1.0.5

11 years ago

1.0.4

11 years ago

1.0.3

11 years ago

1.0.2

12 years ago

1.0.1

12 years ago

1.0.0

12 years ago

0.0.16

12 years ago

0.0.15

12 years ago

0.0.14

12 years ago

0.0.13

12 years ago

0.0.12

12 years ago

0.0.11

12 years ago

0.0.10

13 years ago

0.0.9

13 years ago

0.0.8

13 years ago

0.0.7

13 years ago

0.0.6

13 years ago

0.0.4

13 years ago

0.0.2

13 years ago

0.0.1

13 years ago