{"_id":"dustfs","_rev":"14-cd2d79608e970fc833cd40a8d05eeddb","name":"dustfs","description":"Simplified interface to {dust} and file templates for Node.js","dist-tags":{"latest":"0.0.7"},"versions":{"0.0.1":{"author":{"name":"Jaakko-Heikki Heusala","email":"jheusala@iki.fi","url":"http://www.jhh.me"},"name":"dustfs","description":"Simplified interface to {dust} and file templates for Node.js","version":"0.0.1","repository":{"type":"git","url":"git://github.com/jheusala/dustfs.git"},"main":"src/dustfs.js","engines":{"node":"~v0.4.10"},"dependencies":{"dust":">=0.3.0","snippets":">=0.0.5"},"devDependencies":{},"_npmJsonOpts":{"file":"/home/users/jhh/.npm/dustfs/0.0.1/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"dustfs@0.0.1","_engineSupported":true,"_npmVersion":"1.0.22","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"4f23fea6a230b09243f6f53de34477ba4a3f3a40","tarball":"https://registry.npmjs.org/dustfs/-/dustfs-0.0.1.tgz","integrity":"sha512-4ujgSGaZ5t8Qbhgk3XIDpsQt33DMBlwJ6fb+0+tkcCZhiMtN0ZW0Am2J0VrpcC3tIoTbLZBi7uKC+5ZDDZA37w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIChS4qYnMyHXIr6H3ey1iimSqe1DpJFiGLmW2ibsPnlaAiBoVp47JcYm3KQpHbM8DKDLuwdu5Q7icoyQW9K39AAUCw=="}]},"scripts":{},"maintainers":[{"name":"jhh","email":"jhh@sendanor.com"}]},"0.0.2":{"author":{"name":"Jaakko-Heikki Heusala","email":"jheusala@iki.fi","url":"http://www.jhh.me"},"name":"dustfs","description":"Simplified interface to {dust} and file templates for Node.js","version":"0.0.2","repository":{"type":"git","url":"git://github.com/jheusala/dustfs.git"},"main":"src/dustfs.js","engines":{"node":"~v0.4.10"},"dependencies":{"dust":">=0.3.0","snippets":">=0.0.5"},"devDependencies":{},"_npmJsonOpts":{"file":"/home/users/jhh/.npm/dustfs/0.0.2/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"dustfs@0.0.2","_engineSupported":true,"_npmVersion":"1.0.22","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"d8b9efa0065847740f9d727285945c2f4ae5ab02","tarball":"https://registry.npmjs.org/dustfs/-/dustfs-0.0.2.tgz","integrity":"sha512-2iHvwHPCaBZNKLzPWWOVAV8+c82aOAX9oud2Lm68JgrJlZSqh1LTd3VELWN1ybvcUiD6Ivr8XcxThPLCv3pifw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEAHbLyYRfwoWiRbjd4rbPYhKSihX4Jbsv3DnSiDov8mAiBFEL6X9q8bgsmlFKVVlAHHo9lwTixh/psJTlFIvs/4AQ=="}]},"scripts":{},"maintainers":[{"name":"jhh","email":"jhh@sendanor.com"}]},"0.0.3":{"author":{"name":"Jaakko-Heikki Heusala","email":"jheusala@iki.fi","url":"http://www.jhh.me"},"name":"dustfs","description":"Simplified interface to {dust} and file templates for Node.js","version":"0.0.3","repository":{"type":"git","url":"git://github.com/jheusala/dustfs.git"},"main":"src/dustfs.js","engines":{"node":">=0.4.0"},"dependencies":{"dust":">=0.3.0","snippets":">=0.0.5"},"devDependencies":{},"_npmUser":{"name":"jhh","email":"jhh@sendanor.com"},"_id":"dustfs@0.0.3","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"98b6126bd5a7ef19e0edcfefda179fb70da087d4","tarball":"https://registry.npmjs.org/dustfs/-/dustfs-0.0.3.tgz","integrity":"sha512-OblSaLVT7vtai72p1GoLUxveDCaXAM2aFZVOmJMJcyJC3cpcxitCy+oAy/Z1xdVTjpJq4yQyMuvObomfJWQD5Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEMCHya7j12FcKvZiHHZyldADtrVlKd8FXWjhaAS6PbWL88CIH/aN2bRWVLM6b2ll3HcKTvrHEE8KXfZYPinrvlL5A1i"}]},"maintainers":[{"name":"jhh","email":"jhh@sendanor.com"}]},"0.0.5":{"author":{"name":"Jaakko-Heikki Heusala","email":"jheusala@iki.fi","url":"http://www.jhh.me"},"name":"dustfs","description":"Simplified interface to {dust} and file templates for Node.js","version":"0.0.5","repository":{"type":"git","url":"git://github.com/jheusala/dustfs.git"},"main":"src/dustfs.js","engines":{"node":">=0.6.0"},"dependencies":{"dustjs-linkedin":"dustjs-linkedin","snippets":">=0.0.5"},"devDependencies":{},"_npmUser":{"name":"jhh","email":"jhh@sendanor.com"},"_id":"dustfs@0.0.5","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"a4010c6c63c984dfe62f0516c8e49f26ebdbcd21","tarball":"https://registry.npmjs.org/dustfs/-/dustfs-0.0.5.tgz","integrity":"sha512-fNBxWoSmX8YjkKh+CTJHsbh6eGOmgJqHHvQC+rfTmOykk1onPEgxcFKlKDAA4m+9RBh17zB7/GdbMeWDkuh8DA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEEQZzQlYK1dCIqXCxQiJMm5iSBSAfrKfJlhWN2Bsm8nAiAwmilXTHvGwX8MP0pmelRXBIHVJJZ/nc2iTEmVTvBgLw=="}]},"maintainers":[{"name":"jhh","email":"jhh@sendanor.com"}]},"0.0.6":{"author":{"name":"Jaakko-Heikki Heusala","email":"jheusala@iki.fi","url":"http://www.jhh.me"},"name":"dustfs","description":"Simplified interface to {dust} and file templates for Node.js","version":"0.0.6","repository":{"type":"git","url":"git://github.com/jheusala/dustfs.git"},"main":"src/dustfs.js","engines":{"node":">=0.6.0"},"dependencies":{"dustjs-linkedin":"*","snippets":">=0.0.5"},"devDependencies":{},"_npmUser":{"name":"jhh","email":"jhh@sendanor.com"},"_id":"dustfs@0.0.6","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"b050241a0e203114f948c9a246630bfeb95a0809","tarball":"https://registry.npmjs.org/dustfs/-/dustfs-0.0.6.tgz","integrity":"sha512-kVMcrbLV2q4UcIL4R3KoOI/5jft3GmX1ZbPI3kHZmp+DNe9Ai2ABaAQimxRgguA8NBPB9LB0DxPyz/PXgnU4iw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB38U5H2fVCXn6vCxqjT6uedPDnBT8xfw0jwJv0UDoZUAiA1s4yDqGl7jVIoZs5OLdNi2RL6f9qcLhl33BNJs7Dg6A=="}]},"maintainers":[{"name":"jhh","email":"jhh@sendanor.com"}]},"0.0.7":{"author":{"name":"Jaakko-Heikki Heusala","email":"jheusala@iki.fi","url":"http://www.jhh.me"},"name":"dustfs","description":"Simplified interface to {dust} and file templates for Node.js","version":"0.0.7","repository":{"type":"git","url":"git://github.com/jheusala/dustfs.git"},"main":"src/dustfs.js","engines":{"node":">=0.6.0"},"dependencies":{"dustjs-linkedin":"*","dustjs-helpers":"*","snippets":">=0.0.5"},"devDependencies":{},"gitHead":"474725ec3f8a15dd57d03e66eacc3957c22b9e74","bugs":{"url":"https://github.com/jheusala/dustfs/issues"},"homepage":"https://github.com/jheusala/dustfs","_id":"dustfs@0.0.7","scripts":{},"_shasum":"9a952bfa50fcff40cbfb61541348a4d3f0d67e6b","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"jhh","email":"jhh@sendanor.com"},"maintainers":[{"name":"jhh","email":"jhh@sendanor.com"}],"dist":{"shasum":"9a952bfa50fcff40cbfb61541348a4d3f0d67e6b","tarball":"https://registry.npmjs.org/dustfs/-/dustfs-0.0.7.tgz","integrity":"sha512-lekoIwCd1K7Wn9oC8R8AevOtzkx8LXW5AtTmtNHYcggzN3jPdsFIT6t5s5Uw3CCww+J1ETMTJ5kbk7WApv2c8w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGVyi1ozlwK9uH5Ff9Mt2I4kA5CmO4Vf4OEOpBMqqfDMAiEA3Mt8UWQKTuiWt96MRjhBNwEDMwMvNS/e/lSnoKWjM98="}]}}},"maintainers":[{"name":"jhh","email":"jhh@sendanor.com"}],"time":{"modified":"2022-06-16T02:00:44.057Z","created":"2011-08-09T06:01:23.599Z","0.0.1":"2011-08-09T06:01:28.263Z","0.0.2":"2011-08-09T06:41:20.124Z","0.0.3":"2012-05-27T16:54:53.446Z","0.0.5":"2012-05-27T17:14:10.928Z","0.0.6":"2012-05-27T17:15:16.663Z","0.0.7":"2015-12-17T12:36:23.260Z"},"author":{"name":"Jaakko-Heikki Heusala","email":"jheusala@iki.fi","url":"http://www.jhh.me"},"repository":{"type":"git","url":"git://github.com/jheusala/dustfs.git"},"readme":"\n{dust} with fs\n==============\n\nDescription\n-----------\n\nThis is a simplified interface to use templates from filesystem with \n[{dust}](http://akdubya.github.com/dustjs/) using Node.js.\n\nInstallation for Node.js\n------------------------\n\nSimplest way to install is to use [npm](http://npmjs.org/), just simply `npm \ninstall dustfs`. This will also install {dust} from npm.\n\nLicense\n-------\n\nMIT-style license, see [INSTALL.txt](http://github.com/jheusala/js-snippets/blob/master/LICENSE.txt).\n\nExample 1 - Single template\n---------------------------\n\nFile `templates/hello.dust`:\n\n\tHello {name}!\n\nFile `hello.js`:\n\n\tvar dustfs = require('dustfs');\n\tdustfs.dirs('templates'); // Read templates from this directory\n\tdustfs.render('hello.dust', {'name':'Captain Jack'}, function(err, out) {\n\t\tif(err) console.log('Error: '+err);\n\t\telse console.log(out);\n\t});\n\nResults for `node hello.js`:\n\n\tHello Captain Jack!\n\nExample 2 - Multiple templates\n------------------------------\n\nFile `templates/layout.dust`:\n\n\t<body>\n\t<div id=\"header\">\n\t{+header}\n\tHeader\n\t{/header}\n\t</div>\n\t<div id=\"content\">\n\t{+content}\n\tDefault content.\n\t{/content}\n\t</div>\n\t</body>\n\nFile `templates/partial.dust`:\n\n\t{>\"layout.dust\"/}\n\t\n\t{<header}\n\tHello, {name}!\n\t{/header}\n\t\n\t{<content}\n\tThis is our own content.\n\t{/content}\n\nFile `partial.js`:\n\n\tvar dustfs = require('dustfs');\n\tdustfs.debug(true);       // Enable optional debug using console.log\n\tdustfs.dirs('templates'); // Read templates from that sub directory\n\tdustfs.render('partial.dust', {'name':'Captain Jack'}, function(err, out) {\n\t\tif(err) console.log('Error: '+err);\n\t\telse console.log('Output:\\n' + out);\n\t});\n\nResults for `node partial.js`:\n\n\t[dustfs] [partial.dust] Waiting until directory loading is done before rendering...\n\t[dustfs] [layout.dust] Template compiled from templates/layout.dust\n\t[dustfs] [layout.dust] Template loaded: templates/layout.dust\n\t[dustfs] [hello.dust] Template compiled from templates/hello.dust\n\t[dustfs] [hello.dust] Template loaded: templates/hello.dust\n\t[dustfs] [partial.dust] Template compiled from templates/partial.dust\n\t[dustfs] [partial.dust] Template loaded: templates/partial.dust\n\t[dustfs] [partial.dust] Loading done! Let's render!\n\t[dustfs] [partial.dust] Rendering template...\n\tOutput:\n\t<body><div id=\"header\">Hello, Captain Jack!</div><div id=\"content\">This is our own content.</div></body>\n\ndustfs.dirs()\n-------------\n\n`dustfs.dirs(directory)` will compile and load all .dust files from the directory. \n\nThere is multiple ways to call `dustfs.dirs`.\n\nFull syntax is:\n\t[returns EventEmiter] dustfs.dirs(dir[, dir2[, ...[, callback]]])\n\nNote that using callbacks is not required since dustfs.render() will also wait \nfor any ongoing loading.\n\nCall to `dustfs.dirs(dir[, dir2[, ...]])` returns an EventEmitter which can be \nused to catch errors or to catch when the loading has ended:\n\n\tvar loading = dustfs.dirs('templates', 'docroot');\n\tloading.on('error', function(err) {\n\t\tconsole.log('Error: '+err);\n\t});\n\tloading.on('end', function() {\n\t\tconsole.log('Loading done!');\n\t});\n\nCall to `dustfs.dirs(dir[, callback])` is a second way to handle events:\n\n\tvar loading = dustfs.dirs('templates', function(err) {\n\t\tif(err) console.log('Errors: ' + err);\n\t\telse console.log('Loading done!');\n\t});\n\ndustfs.render()\n-------------\n\nCall to `dustfs.render(name, context, callback)` will render the named template \nwith provided context, and after that execute the callback with results:\n\n\tdustfs.render('partial.dust', {'name':'Captain Jack'}, function(err, out) {\n\t\tif(err) console.log('Error: '+err);\n\t\telse console.log('Output:\\n' + out);\n\t});\n","homepage":"https://github.com/jheusala/dustfs","bugs":{"url":"https://github.com/jheusala/dustfs/issues"},"readmeFilename":"README.md"}