Skip to content
Browse files

Added more documentation

  • Loading branch information...
1 parent 909c4c6 commit ece21a99034daff05f890f5a0c698d3c3cb71b8d @jheusala committed Aug 9, 2011
Showing with 16 additions and 2 deletions.
  1. +15 −1 README.md
  2. +1 −1 package.json
View
16 README.md
@@ -96,12 +96,15 @@ Results for `node partial.js`:
dustfs.dirs()
-------------
+`dustfs.dirs(directory)` will compile and load all .dust files from the directory.
+
There is multiple ways to call `dustfs.dirs`.
Full syntax is:
[returns EventEmiter] dustfs.dirs(dir[, dir2[, ...[, callback]]])
-Note that dustfs.render() will also wait for any ongoing call to dirs() so handling callbacks is not required.
+Note that using callbacks is not required since dustfs.render() will also wait
+for any ongoing loading.
Call to `dustfs.dirs(dir[, dir2[, ...]])` returns an EventEmitter which can be
used to catch errors or to catch when the loading has ended:
@@ -120,3 +123,14 @@ Call to `dustfs.dirs(dir[, callback])` is a second way to handle events:
if(err) console.log('Errors: ' + err);
else console.log('Loading done!');
});
+
+dustfs.render()
+-------------
+
+Call to `dustfs.render(name, context, callback)` will render the named template
+with provided context, and after that execute the callback with results:
+
+ dustfs.render('partial.dust', {'name':'Captain Jack'}, function(err, out) {
+ if(err) console.log('Error: '+err);
+ else console.log('Output:\n' + out);
+ });
View
2 package.json
@@ -2,7 +2,7 @@
"author": "Jaakko-Heikki Heusala <jheusala@iki.fi> (http://www.jhh.me)",
"name": "dustfs",
"description": "Simplified interface to {dust} and file templates for Node.js",
- "version": "0.0.1",
+ "version": "0.0.2",
"repository": {
"type": "git",
"url": "git://github.com/jheusala/dustfs.git"

0 comments on commit ece21a9

Please sign in to comment.
Something went wrong with that request. Please try again.