assemble-render-file
Advanced tools
Comparing version 0.4.0 to 0.4.1
23
index.js
@@ -29,5 +29,5 @@ /*! | ||
return function(app) { | ||
config = utils.merge({}, app.options, config); | ||
var opts = utils.merge({}, this.options, config); | ||
app.define('renderFile', function(engine, locals) { | ||
this.define('renderFile', function(engine, locals) { | ||
if (typeof engine !== 'string') { | ||
@@ -39,9 +39,14 @@ locals = engine; | ||
debug('renderFile: engine "%s"', engine); | ||
var opts = {}; | ||
locals = locals || {}; | ||
var collection = {}; | ||
if (locals && !locals.isCollection) { | ||
opts = utils.merge({}, config, locals); | ||
opts = utils.merge({}, opts, locals); | ||
} else { | ||
collection = locals; | ||
locals = {}; | ||
} | ||
var View = opts.View || opts.File || app.View; | ||
var View = opts.View || opts.File || collection.View || this.View; | ||
@@ -56,3 +61,3 @@ return utils.through.obj(function(file, enc, next) { | ||
// run `onLoad` middleware | ||
app.handleView('onLoad', file, function(err, view) { | ||
app.handleOnce('onLoad', file, function(err, view) { | ||
if (err) return next(err); | ||
@@ -63,5 +68,8 @@ | ||
// create the context to pass to templates | ||
var ctx = utils.merge({}, app.cache.data, locals, view.data); | ||
var ctx = view.context(app.context(locals)); | ||
ctx.engine = resolveEngine(app, ctx, engine); | ||
// set context on `view` so it's not re-merged by `compile` | ||
view._context = ctx; | ||
if (!ctx.engine && app.option('engineStrict') === false) { | ||
@@ -96,4 +104,3 @@ next(null, view); | ||
} | ||
return ctx.engine; | ||
} |
{ | ||
"name": "assemble-render-file", | ||
"description": "Assemble plugin for rendering views in a vinyl pipeline.", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"homepage": "https://github.com/jonschlinkert/assemble-render-file", | ||
@@ -30,3 +30,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"devDependencies": { | ||
"assemble-core": "^0.13.1", | ||
"assemble-core": "^0.14.0", | ||
"engine-base": "^0.1.2", | ||
@@ -57,3 +57,3 @@ "engine-handlebars": "^0.8.0", | ||
"run": true, | ||
"toc": "N", | ||
"toc": false, | ||
"layout": "default", | ||
@@ -60,0 +60,0 @@ "tasks": [ |
@@ -10,3 +10,3 @@ # assemble-render-file [![NPM version](https://img.shields.io/npm/v/assemble-render-file.svg)](https://www.npmjs.com/package/assemble-render-file) [![Build Status](https://img.shields.io/travis/jonschlinkert/assemble-render-file.svg)](https://travis-ci.org/jonschlinkert/assemble-render-file) | ||
```sh | ||
$ npm i assemble-render-file --save | ||
$ npm install assemble-render-file --save | ||
``` | ||
@@ -71,9 +71,9 @@ | ||
Generate readme and API documentation with [verb][]: | ||
Generate readme and API documentation with [verb](https://github.com/verbose/verb): | ||
```sh | ||
$ npm i -d && npm run docs | ||
$ npm install verb && npm run docs | ||
``` | ||
Or, if [verb][] is installed globally: | ||
Or, if [verb](https://github.com/verbose/verb) is installed globally: | ||
@@ -89,3 +89,3 @@ ```sh | ||
```sh | ||
$ npm i -d && npm test | ||
$ npm install -d && npm test | ||
``` | ||
@@ -107,2 +107,2 @@ | ||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on February 22, 2016._ | ||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on March 05, 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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
9158
96
0