Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add support for global properties in templates

  • Loading branch information...
commit 472bd9da230111a5a9371276f792dfa77ca9f8bb 1 parent d5dcfc0
@pvorb authored
Showing with 6 additions and 3 deletions.
  1. +1 −2  .tpl/conf.json
  2. +5 −1 tpl.js
View
3  .tpl/conf.json
@@ -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));
Please sign in to comment.
Something went wrong with that request. Please try again.