1.1.0 • Published 10 years ago

jstr v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

simple template for node

Simple but more with dynamic include, syntax/runtime error caught with file path and line no, non-block file render(require fibext)

Installation

npm install --save jstr

Simple usage

var fibext = require('fibext');
var jstr = require('jstr');
var r = jstr({debug: false});
fibext(function(){
  var output = r.renderFile('/path/to/file.html', {name: 'kiliwalk', arr: [1, 2, 3]});
  console.log(output);
});

/path/to/file.html:

<html>
  <body>
    <@name@>
    <ul><!--@for(var i in arr){-->
      <li><@arr[i]@></li><!--@}-->
    </ul>
    <@|include('include/part.html')@>
  </body>
</html>

/path/to/include/part.html:

<p>
  <@name@>
</p>

More usages

Please refer to the test cases to get more usage examples.

TODO

  • readme
  • more test and coverage test

License

Licensed under MIT

Copyright (c) 2015 kiliwalk

1.1.0

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago