{"_id":"blue","_rev":"5-7c989d3750bf7fb34385bbd5255b9bc6","name":"blue","description":"Streaming template engine","dist-tags":{"latest":"1.1.1"},"versions":{"1.1.1":{"name":"blue","version":"1.1.1","description":"Streaming template engine","main":"index.js","directories":{"test":"test"},"dependencies":{"stream-stream":"~1.1.0"},"devDependencies":{"nodeunit":"0.7","stream-sink":"1.x.x"},"scripts":{"test":"nodeunit test/test-*.js"},"repository":{"type":"git","url":"git@github.com:Floby/node-blue.git"},"keywords":["Stream","Streaming","template","engine","ejs"],"author":{"name":"Florent Jaby","email":"florent.jaby@gmail.com"},"license":"MIT","readme":"[![Build Status](https://secure.travis-ci.org/Floby/node-blue.png?branch=master)](http://travis-ci.org/Floby/node-blue)\n\n> Blue is a simple JSP-like, streamed template engine for [NodeJS](http://github.com/ry/node).\n\n## Setup\n\n### Git\n\n\tgit clone http://github.com/Floby/node-blue.git\n\n### Npm\n[npm](http://github.com/isaacs/npm) is a package manager for node\n\n\tnpm install blue\n\n## Using\n\n### Plus\n\nThe major interest of Blue resides in its streamed nature. When working with templates, you\nare very likely to include templates from templates which were included from other templates.\nThe Blue engine doesn't wait for an included file to be read, compiled and processed. It just\nbuffers the results of the current template until it can be sent.\n\n### Example\n\nblue exports a `Template` class which you'll need to instanciate\n\n\tvar Template = require('blue').Template;\n\tvar template = new Template('mytemplate.tpl', {dummy:'dummy'})\n\ttemplate.on('data', function(data) {\n\t  sys.print(data);\n\t})\n\ttemplate.run();\n\nthe Template class follow more or less the Readable Stream interface (I plan on fully implementing it very soon).\n\n### Methods\n* `data([object])` : Getter/Setter on the data that will be passed to the template\n* `sandbox(object)` : Sets the template to be sandboxed when run. See `Script`\n* `sandbox(false)` : Unsets the sandbox behavior if set previously\n* `run()` : Runs the template\n\n### Events\n* `'data' : function(data)`  emitted when a new chunk of data is available\n* `'end' : function()` emitted when the template has been fully processed\n* `'error' : function(err)` emitter when some kind of error happens, most likely to be an exception that has been caught\n\n### Template syntax\n\nThe template syntax is inspired by JSP. you can include javascript code in the middle of your\nfile if you put `<%` and `%>` around. by default the `print()` and `include()` function are available\nfrom the template. Others may be available depending on the sandboxing behaviour. `print(data)` will\nwrite `data` out and `include('filename')` will process `filename` as a template and insert the\nresult where the call was made. `filename` can be a relative or absolute path.\n\n* `<%= {expression} %>` is a shortcut for print({expression}).\n* `<%@ 'filename' %>` is a shortcut for include(filename). Note that if it is constant, quotes\nmust be used.\n\n\n```jsp\n<html>\n  <head>\n    <title> <%= data.title /* accessing passed in data */ %> </title>\n  </head>\n  <body>\n    <ul>\n      <% for(var i = 0 ; i<5 ; ++i) { %>\n          <li> <%= i %> </li>\n      <% } %>\n    </ul>\n    <%@ 'paragraph.tpl' %>\n  </body>\n</html>\n```\n\n\n","readmeFilename":"README.md","_id":"blue@1.1.1","dist":{"shasum":"062b05d4921b20e9905eb9f02f4096091b493252","tarball":"https://registry.npmjs.org/blue/-/blue-1.1.1.tgz","integrity":"sha512-zw0Cqhj0EpIXrLzKAuKqSnMcDXeBjwPhzimDEPZ2gQxlwR4NH3YyagVyBmljJoWQDkrU02k8EYG0Le31HvfWbw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDNqp+7ad5Sz8yCBpkNN63cck6dtJIlziOJZrhROUlxTAIhAIWt+omMM/dpv1RjNgBlE+a1GPvJanxsR4RjI6E8CT3r"}]},"_from":".","_npmVersion":"1.2.15","_npmUser":{"name":"floby","email":"florent.jaby@gmail.com"},"maintainers":[{"name":"floby","email":"florent.jaby@gmail.com"}]}},"readme":"[![Build Status](https://secure.travis-ci.org/Floby/node-blue.png?branch=master)](http://travis-ci.org/Floby/node-blue)\n\n> Blue is a simple JSP-like, streamed template engine for [NodeJS](http://github.com/ry/node).\n\n## Setup\n\n### Git\n\n\tgit clone http://github.com/Floby/node-blue.git\n\n### Npm\n[npm](http://github.com/isaacs/npm) is a package manager for node\n\n\tnpm install blue\n\n## Using\n\n### Plus\n\nThe major interest of Blue resides in its streamed nature. When working with templates, you\nare very likely to include templates from templates which were included from other templates.\nThe Blue engine doesn't wait for an included file to be read, compiled and processed. It just\nbuffers the results of the current template until it can be sent.\n\n### Example\n\nblue exports a `Template` class which you'll need to instanciate\n\n\tvar Template = require('blue').Template;\n\tvar template = new Template('mytemplate.tpl', {dummy:'dummy'})\n\ttemplate.on('data', function(data) {\n\t  sys.print(data);\n\t})\n\ttemplate.run();\n\nthe Template class follow more or less the Readable Stream interface (I plan on fully implementing it very soon).\n\n### Methods\n* `data([object])` : Getter/Setter on the data that will be passed to the template\n* `sandbox(object)` : Sets the template to be sandboxed when run. See `Script`\n* `sandbox(false)` : Unsets the sandbox behavior if set previously\n* `run()` : Runs the template\n\n### Events\n* `'data' : function(data)`  emitted when a new chunk of data is available\n* `'end' : function()` emitted when the template has been fully processed\n* `'error' : function(err)` emitter when some kind of error happens, most likely to be an exception that has been caught\n\n### Template syntax\n\nThe template syntax is inspired by JSP. you can include javascript code in the middle of your\nfile if you put `<%` and `%>` around. by default the `print()` and `include()` function are available\nfrom the template. Others may be available depending on the sandboxing behaviour. `print(data)` will\nwrite `data` out and `include('filename')` will process `filename` as a template and insert the\nresult where the call was made. `filename` can be a relative or absolute path.\n\n* `<%= {expression} %>` is a shortcut for print({expression}).\n* `<%@ 'filename' %>` is a shortcut for include(filename). Note that if it is constant, quotes\nmust be used.\n\n\n```jsp\n<html>\n  <head>\n    <title> <%= data.title /* accessing passed in data */ %> </title>\n  </head>\n  <body>\n    <ul>\n      <% for(var i = 0 ; i<5 ; ++i) { %>\n          <li> <%= i %> </li>\n      <% } %>\n    </ul>\n    <%@ 'paragraph.tpl' %>\n  </body>\n</html>\n```\n\n\n","maintainers":[{"name":"floby","email":"florent.jaby@gmail.com"}],"time":{"modified":"2022-06-13T04:50:49.576Z","created":"2013-03-29T15:43:11.935Z","1.1.1":"2013-03-29T15:43:20.371Z"},"author":{"name":"Florent Jaby","email":"florent.jaby@gmail.com"},"repository":{"type":"git","url":"git@github.com:Floby/node-blue.git"}}