templates
Advanced tools
Comparing version 0.24.0 to 0.24.1
@@ -391,4 +391,4 @@ /*! | ||
Templates.Views = lib.views; | ||
Templates.Item = require('vinyl-item'); | ||
Templates.View = require('vinyl-view'); | ||
Templates.Item = lib.item; | ||
Templates.View = lib.view; | ||
@@ -395,0 +395,0 @@ /** |
@@ -33,3 +33,5 @@ 'use strict'; | ||
utils.extend(opts, view.options); | ||
utils.extend(opts, view.context()); | ||
if (typeof view.context === 'function') { | ||
utils.extend(opts, view.context()); | ||
} | ||
@@ -36,0 +38,0 @@ // if no layout is defined, `app.options.layout` |
@@ -135,3 +135,4 @@ 'use strict'; | ||
var engineOpts = utils.merge({}, locals.settings, engine.options); | ||
var ctx = view._context || this.context(view, locals); | ||
console.log(view.context) | ||
var ctx = cacheContext(this, view, locals); | ||
@@ -276,3 +277,3 @@ // apply layout | ||
var ctx = view._context = this.context(view, locals); | ||
var ctx = cacheContext(this, view, locals); | ||
var app = this; | ||
@@ -295,3 +296,5 @@ | ||
// so it can be used by `compile` | ||
file._context = ctx; | ||
if (app.options.cacheContext === true) { | ||
file._context = ctx; | ||
} | ||
@@ -303,3 +306,3 @@ // compile the view | ||
// build the context one more time in case it has changed | ||
var context = view._context || view.context(ctx); | ||
var context = cacheContext(app, file, ctx); | ||
@@ -336,1 +339,13 @@ // render the view | ||
} | ||
function cacheContext(app, file, context) { | ||
if (typeof app.options.cacheContext === 'function') { | ||
file._context = app.options.cacheContext(file, context, app); | ||
} else if (app.options.cacheContext === true && typeof file.context === 'function') { | ||
return (file._context || file.context(context)); | ||
} else if (typeof file.context === 'function') { | ||
return file.context(context); | ||
} else { | ||
return context; | ||
} | ||
} |
{ | ||
"name": "templates", | ||
"description": "System for creating and managing template collections, and rendering templates with any node.js template engine. Can be used as the basis for creating a static site generator or blog framework.", | ||
"version": "0.24.0", | ||
"version": "0.24.1", | ||
"homepage": "https://github.com/jonschlinkert/templates", | ||
@@ -14,4 +14,7 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"index.js", | ||
"lib" | ||
"lib", | ||
"LICENSE", | ||
"README.md" | ||
], | ||
"main": "index.js", | ||
"engines": { | ||
@@ -65,3 +68,3 @@ "node": ">=4.0.0" | ||
"gulp": "^3.9.1", | ||
"gulp-eslint": "^2.1.0", | ||
"gulp-eslint": "^3.0.0", | ||
"gulp-format-md": "^0.1.9", | ||
@@ -72,3 +75,3 @@ "gulp-istanbul": "^1.0.0", | ||
"remarkable": "^1.6.2", | ||
"verb-readme-generator": "^0.1.16", | ||
"verb-generate-readme": "^0.1.21", | ||
"yargs-parser": "^2.4.0" | ||
@@ -90,7 +93,13 @@ }, | ||
], | ||
"lintDeps": { | ||
"ignore": [ | ||
"coverage" | ||
] | ||
}, | ||
"verb": { | ||
"toc": { | ||
"render": true | ||
}, | ||
"toc": true, | ||
"layout": "default", | ||
"tasks": [ | ||
"readme" | ||
], | ||
"plugins": [ | ||
@@ -119,2 +128,3 @@ "gulp-format-md" | ||
"paginationator", | ||
"route-api", | ||
"verb", | ||
@@ -127,10 +137,5 @@ "verb-readme-generator", | ||
"lint": { | ||
"reflinks": true | ||
"reflinks": false | ||
} | ||
}, | ||
"lintDeps": { | ||
"ignore": [ | ||
"coverage" | ||
] | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30
3314
108442
1
0