mirror of
https://github.com/vale981/metalsmith-layouts
synced 2025-03-05 09:31:39 -05:00
Merge pull request #8 from akoenig/passing1
Possibility to pass options to the template engine (with lodash.omit).
This commit is contained in:
commit
d0baabe1e6
2 changed files with 7 additions and 2 deletions
|
@ -5,6 +5,7 @@ var each = require('async').each;
|
|||
var extend = require('extend');
|
||||
var join = require('path').join;
|
||||
var match = require('multimatch');
|
||||
var omit = require('lodash.omit');
|
||||
|
||||
/**
|
||||
* Expose `plugin`.
|
||||
|
@ -34,6 +35,9 @@ function plugin(opts){
|
|||
var pattern = opts.pattern;
|
||||
var inPlace = opts.inPlace;
|
||||
var def = opts.default;
|
||||
var engineparams = omit(opts, [
|
||||
'engine', 'directory', 'pattern', 'inPlace', 'default'
|
||||
]);
|
||||
|
||||
return function(files, metalsmith, done){
|
||||
var metadata = metalsmith.metadata();
|
||||
|
@ -43,7 +47,7 @@ function plugin(opts){
|
|||
function convert(file, done){
|
||||
debug('checking file: %s', file);
|
||||
var data = files[file];
|
||||
var clone = extend({}, metadata, data);
|
||||
var clone = extend({}, engineparams, metadata, data);
|
||||
var tmpl = data.template || def;
|
||||
var render;
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
"async": "~0.2.10",
|
||||
"debug": "~0.7.4",
|
||||
"extend": "~1.2.1",
|
||||
"multimatch": "^0.1.0"
|
||||
"multimatch": "^0.1.0",
|
||||
"lodash.omit": "~2.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "1.x",
|
||||
|
|
Loading…
Add table
Reference in a new issue