mirror of
https://github.com/vale981/metalsmith-layouts
synced 2025-03-04 17:21:37 -05:00
0.0.5
* stringify `contents` on the original file data
This commit is contained in:
parent
71a790621c
commit
388c30ecda
3 changed files with 14 additions and 8 deletions
|
@ -1,4 +1,8 @@
|
|||
|
||||
0.0.5 - February 7, 2013
|
||||
------------------------
|
||||
* stringify `contents` on the original file data
|
||||
|
||||
0.0.4 - February 6, 2013
|
||||
------------------------
|
||||
* switch to `extend` from `defaults` to avoid cloning
|
||||
|
|
16
lib/index.js
16
lib/index.js
|
@ -28,17 +28,19 @@ function plugin(opts){
|
|||
each(Object.keys(files), convert, done);
|
||||
|
||||
function convert(file, done){
|
||||
debug('checking file: %s', file);
|
||||
var data = files[file];
|
||||
if (!data.template) return done();
|
||||
|
||||
debug('converting file: %s', file);
|
||||
var data = extend({}, metadata, files[file]);
|
||||
var template = data.template;
|
||||
if (!template) return done();
|
||||
var tmpl = metalsmith.join(opts.dir, template);
|
||||
debug('stringify file: %s', file);
|
||||
data.contents = data.contents.toString();
|
||||
consolidate[opts.engine](tmpl, data, function(err, str){
|
||||
var tmpl = metalsmith.join(opts.dir, data.template);
|
||||
var clone = extend({}, metadata, data);
|
||||
|
||||
consolidate[opts.engine](tmpl, clone, function(err, str){
|
||||
if (err) return done(err);
|
||||
data.contents = new Buffer(str);
|
||||
debug('converted file: %s', file);
|
||||
files[file].contents = new Buffer(str);
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "metalsmith-templates",
|
||||
"description": "A metalsmith plugin to render files with templates.",
|
||||
"repository": "git://github.com/segmentio/metalsmith-templates.git",
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.5",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
|
|
Loading…
Add table
Reference in a new issue