templates
Advanced tools
Comparing version 0.15.4 to 0.15.5
@@ -52,3 +52,15 @@ 'use strict'; | ||
Group.prototype.init = function() { | ||
this.define('options', this.options); | ||
var opts = {}; | ||
Object.defineProperty(this, 'options', { | ||
configurable: true, | ||
enumerable: false, | ||
set: function(val) { | ||
opts = val; | ||
}, | ||
get: function() { | ||
return opts || {}; | ||
} | ||
}); | ||
this.define('cache', this.cache); | ||
@@ -55,0 +67,0 @@ this.define('List', this.List || require('./list')); |
@@ -116,3 +116,3 @@ 'use strict'; | ||
var ignored = ['_contents', 'stat', 'history', 'path', 'base', 'cwd']; | ||
var ignored = ['_contents', 'stat', 'history', 'path', 'base', 'cwd', 'options', 'data']; | ||
for (var key in this) { | ||
@@ -123,2 +123,10 @@ if (ignored.indexOf(key) < 0) { | ||
} | ||
if (opts.deep !== true) { | ||
item.options = this.options; | ||
item.data = this.data; | ||
} else { | ||
item.options = utils.extend({}, this.options); | ||
item.data = utils.extend({}, this.data); | ||
} | ||
return item; | ||
@@ -166,3 +174,3 @@ }; | ||
* Normalize the `content` and contents` properties on `item`. | ||
* This is cb to ensure compatibility with the vinyl standard | ||
* This is done to ensure compatibility with the vinyl standard | ||
* of using `contents` as a Buffer, as well as the assemble | ||
@@ -169,0 +177,0 @@ * standard of using `content` as a string. |
@@ -30,4 +30,2 @@ 'use strict'; | ||
this.define(method, function(key, value) { | ||
var Item, item; | ||
if (!value && typeof key === 'string') { | ||
@@ -50,4 +48,4 @@ value = { path: key }; | ||
Item = this.get(CtorName); | ||
item = !(value instanceof Item) | ||
var Item = this.get(CtorName); | ||
var item = !(value instanceof Item) | ||
? new Item(value) | ||
@@ -81,2 +79,8 @@ : value; | ||
this.emit(method, item, item.options.collection, this); | ||
// if `isApp`, run plugins on `item`, otherwise this is handled by collections | ||
if (app.isApp) { | ||
app.run(item); | ||
} | ||
return item; | ||
@@ -83,0 +87,0 @@ }); |
'use strict'; | ||
var common = require('./common'); | ||
var utils = require('./common'); | ||
var lazy = require('./lazy'); | ||
/** | ||
* Expose view and collection utils | ||
*/ | ||
var utils = module.exports; | ||
/** | ||
* Return true if the given value looks like a | ||
@@ -17,4 +11,4 @@ * `view` object. | ||
utils.isItem = utils.isView = function(val) { | ||
if (!common.isObject(val)) return false; | ||
exports.isItem = exports.isView = function(val) { | ||
if (!utils.isObject(val)) return false; | ||
return val.hasOwnProperty('content') | ||
@@ -33,3 +27,3 @@ || val.hasOwnProperty('contents') | ||
utils.syncContents = function(view, contents) { | ||
exports.syncContents = function(view, contents) { | ||
if (typeof view._contents === 'undefined') { | ||
@@ -47,7 +41,7 @@ view.define('_contents', null); | ||
} | ||
if (common.isBuffer(contents)) { | ||
if (utils.isBuffer(contents)) { | ||
view._contents = contents; | ||
view._content = contents.toString(); | ||
} | ||
if (common.isStream(contents)) { | ||
if (utils.isStream(contents)) { | ||
view._contents = contents; | ||
@@ -65,3 +59,3 @@ view._content = contents; | ||
utils.getLocals = function(locals, options) { | ||
exports.getLocals = function(locals, options) { | ||
options = options || {}; | ||
@@ -97,7 +91,7 @@ locals = locals || {}; | ||
utils.resolveEngine = function(view, locals, opts) { | ||
exports.resolveEngine = function(view, locals, opts) { | ||
var engine = locals.engine || view.engine || opts.engine; | ||
var fn = opts.resolveEngine | ||
|| locals.resolveEngine | ||
|| common.identity; | ||
|| utils.identity; | ||
return fn(engine); | ||
@@ -115,3 +109,3 @@ }; | ||
utils.resolveLayout = function(view) { | ||
exports.resolveLayout = function(view) { | ||
var layout; | ||
@@ -118,0 +112,0 @@ if (view.options && typeof view.options.resolveLayout === 'function') { |
{ | ||
"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.15.4", | ||
"version": "0.15.5", | ||
"homepage": "https://github.com/jonschlinkert/templates", | ||
@@ -28,3 +28,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"base-data": "^0.4.0", | ||
"base-option": "^0.6.2", | ||
"base-option": "^0.7.0", | ||
"base-plugins": "^0.4.4", | ||
@@ -31,0 +31,0 @@ "clone": "^1.0.2", |
@@ -1972,2 +1972,2 @@ # templates [![NPM version](https://img.shields.io/npm/v/templates.svg)](https://www.npmjs.com/package/templates) [![Build Status](https://img.shields.io/travis/jonschlinkert/templates.svg)](https://travis-ci.org/jonschlinkert/templates) | ||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on March 05, 2016._ | ||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on March 09, 2016._ |
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
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
169354
4089
+ Addedbase-option@0.7.0(transitive)
- Removedbase-option@0.6.2(transitive)
Updatedbase-option@^0.7.0