{"_id":"helper-read","_rev":"95705","name":"helper-read","description":"Template helper for reading from the file system. Includes both async and sync versions.","dist-tags":{"latest":"0.1.0"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T10:31:55.000Z","created":"2015-05-12T02:39:05.229Z","0.1.0":"2015-05-12T02:39:05.229Z"},"users":{},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/helper-read.git"},"versions":{"0.1.0":{"name":"helper-read","description":"Template helper for reading from the file system. Includes both async and sync versions.","version":"0.1.0","homepage":"https://github.com/jonschlinkert/helper-read","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/helper-read.git"},"bugs":{"url":"https://github.com/jonschlinkert/helper-read/issues"},"license":{"type":"MIT","url":"https://github.com/jonschlinkert/helper-read/blob/master/LICENSE"},"files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"devDependencies":{"engine-lodash":"^0.6.3","lodash":"^3.8.0","mocha":"*","should":"*","template":"^0.14.0"},"keywords":["assemble","async","helper","lodash","read","template","verb"],"gitHead":"1c7cd595d36028095391f220f59cee87473fba20","_id":"helper-read@0.1.0","_shasum":"00995ffb3823697eaa1d2a61b89fa27af5ea1a07","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"00995ffb3823697eaa1d2a61b89fa27af5ea1a07","size":2518,"noattachment":false,"key":"/helper-read/-/helper-read-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/helper-read/download/helper-read-0.1.0.tgz"},"directories":{},"publish_time":1431398345229,"_cnpm_publish_time":1431398345229,"_hasShrinkwrap":false}},"readme":"# helper-read [![NPM version](https://badge.fury.io/js/helper-read.svg)](http://badge.fury.io/js/helper-read)\n\n> Template helper for reading from the file system. Includes both async and sync versions.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/)\n\n```bash\nnpm i helper-read --save\n```\n\n## Usage\n\n```js\nvar read = require('helper-read');\n```\n\n**Usage with [lodash](https://lodash.com/)**\n\n```js\nvar ctx = {read: read.sync};\n_.template('<%= read(\"fixtures/a.txt\") %>')(ctx);\n//=> 'AAA'\n_.template('<%= read(\"fixtures/b.txt\") %>')(ctx);\n//=> 'BBB'\n```\n\n**Usage with [Template](https://github.com/jonschlinkert/template)**\n\n```js\nvar read = require('helper-read');\nvar Template = require('template');\nvar template = new Template();\n\n/**\n * Register an engine\n */\n\ntemplate.engine('foo', require('engine-lodash'));\n\n/**\n * Register the helper\n */\n\ntemplate.asyncHelper('read', read);\n\n/**\n * Add some templates\n */\n\ntemplate.page('abc.foo', '<%= read(\"fixtures/a.txt\") %>');\ntemplate.page('xyz.foo', '<%= read(\"fixtures/b.txt\") %>');\n\n/**\n * Render the templates\n */\n\ntemplate.render('abc.foo', function (err, contents) {\n  if (err) console.log(err);\n  console.log(contents);\n  //=> 'AAA'\n});\n\ntemplate.render('xyz.foo', function (err, contents) {\n  if (err) console.log(err);\n  console.log(contents);\n  //=> 'BBB'\n});\n```\n\n## Related projects\n\n* [assemble](http://assemble.io): Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… [more](http://assemble.io)\n* [template](https://github.com/jonschlinkert/template): Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… [more](https://github.com/jonschlinkert/template)\n* [template-helpers](https://github.com/jonschlinkert/template-helpers): Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or… [more](https://github.com/jonschlinkert/template-helpers)\n* [verb](https://github.com/assemble/verb): Documentation generator for GitHub projects. Extremely powerful, easy to use, can generate anything from API… [more](https://github.com/assemble/verb)\n\n## Running tests\n\nInstall dev dependencies:\n\n```bash\nnpm i -d && npm test\n```\n\n## Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/helper-read/issues/new)\n\n## Author\n\n**Jon Schlinkert**\n\n+ [github/jonschlinkert](https://github.com/jonschlinkert)\n+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)\n\n## License\n\nCopyright (c) 2015 Jon Schlinkert\nReleased under the MIT license.\n\n***\n\n_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 11, 2015._","_attachments":{},"homepage":"https://github.com/jonschlinkert/helper-read","bugs":{"url":"https://github.com/jonschlinkert/helper-read/issues"},"license":{"type":"MIT","url":"https://github.com/jonschlinkert/helper-read/blob/master/LICENSE"}}