Permalink
Browse files

Add support for global properties in templates

  • Loading branch information...
1 parent d5dcfc0 commit 472bd9da230111a5a9371276f792dfa77ca9f8bb @pvorb committed Jan 16, 2012
Showing with 6 additions and 3 deletions.
  1. +1 −2 .tpl/conf.json
  2. +5 −1 tpl.js
View
@@ -1,2 +1 @@
-{
-}
+{}
View
6 tpl.js
@@ -18,7 +18,8 @@ var defaultConf = {
engine: 'ejs',
ext: '.txt'
}
- }
+ },
+ properties: {}
};
function apply(file, opt, cb) {
@@ -44,6 +45,9 @@ function apply(file, opt, cb) {
// require parser
parser = require(path.resolve(dir, 'parsers', parser + '.js'));
+ // overwrite global properties
+ opt = append(conf.properties, opt);
+
// parse file
var doc = append(opt, parser(file));

0 comments on commit 472bd9d

Please sign in to comment.