Skip to content

Commit

Permalink
example in doc; package ID for CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
cadorn committed Nov 2, 2009
1 parent 4b106b0 commit 44f7a0c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
27 changes: 27 additions & 0 deletions README.md
Expand Up @@ -4,6 +4,33 @@ Domplate
JavaScript Template Library


Example
=======

var DOMPLATE = require("domplate", "domplate");
var rep;
with (DOMPLATE.tags) {
rep = DOMPLATE.domplate({
tag: DIV({"style": "color: red;"},"$object|capitalize"),
capitalize: function(str) {
return str.toUpperCase();
}
});
}
var html = rep.tag.render({
object: "Hello World"
});

// html == <div style="color: red;" class=" ">HELLO WORLD</div>


Links
=====

* http://www.softwareishard.com/blog/category/domplate/
* http://code.google.com/p/domplate/
* http://www.christophdorn.com/Blog/category/domplate/


License
=======
Expand Down
11 changes: 7 additions & 4 deletions lib/reps.js
@@ -1,10 +1,14 @@

var FILE = require("file");

var CSS = function(path)
var CSS = function(packageId, path)
{
// this.id = id;
this.path = path;

this.getPackageId = function() {
return packageId;
}

this.getCode = function()
{
Expand All @@ -28,15 +32,14 @@ var Collection = function()
var reps = [];
var css = [];


this.addRep = function(rep)
{
reps.push(rep);
}

this.addCss = function(path)
this.addCss = function(path, packageId)
{
css.push(new CSS(path));
css.push(new CSS(packageId, path));
}

this.getCss = function()
Expand Down

0 comments on commit 44f7a0c

Please sign in to comment.