Permalink
Browse files

[lib doc test] first pass

  • Loading branch information...
1 parent 74508e6 commit dc522e82ed121f7c0f2885a8ebfd5f2728be4a52 Paolo Fragomeni committed Oct 16, 2011
Showing with 557 additions and 0 deletions.
  1. BIN .DS_Store
  2. 0 README
  3. +60 −0 README.md
  4. +397 −0 lib/plates.js
  5. +61 −0 npm-debug.log
  6. +17 −0 package.json
  7. +22 −0 test/test.js
View
BIN .DS_Store
Binary file not shown.
View
0 README
No changes.
View
@@ -0,0 +1,60 @@
+
+## Synopsys
+
+Plates (short for templates) binds data to markup. There's NO special syntax. It works in the browser and in node.js!
+
+## Motivation
+
+- No NON-HTML in your HTML such as <%=foo%> or {{foo}}.
+- Promote portable code/markup by decoupling decision making from presentation.
+- Make both the code and markup more readable and maintainable.
+- Allow designers to write markup and test styling without impacting logic or special placeholders.
+
+## Usage
+
+On the Server
+```js
+
+ var Plate = require('plates');
+ var plate = new Plate;
+
+ var html = '<div id="test">Old Value</div>';
+ var data = { "test": "New Value" };
+
+ var output = plate(html, data).html();
+
+ //
+ // with the output, you could serve it up or process it further with JSDOM
+ //
+
+ response.end(output);
+
+```
+
+On the client
+
+```js
+
+ <script>
+
+ var plate = new Plate;
+
+ var html = '<div id="test">Old Value</div>';
+ var data = { "test": "New Value" };
+
+ var output = plate(html, data).html();
+
+ //
+ // with the output, append it to the current document or use it however you want.
+ //
+ document.body.appendAdjacentHTML(output); // append this to the DOM using native DOM APIs.
+
+ // or... use some jQuery
+
+ $('body').appendChild(output);
+
+ </script>
+
+```
+
+## License
Oops, something went wrong.

0 comments on commit dc522e8

Please sign in to comment.