assemble-render-file
Advanced tools
Comparing version 0.3.1 to 0.3.2
39
index.js
@@ -10,2 +10,3 @@ /*! | ||
var debug = require('debug')('base:assemble:pipeline:render-file'); | ||
var utils = require('./utils'); | ||
@@ -37,3 +38,5 @@ | ||
debug('renderFile: engine "%s"', engine); | ||
var opts = {}; | ||
if (locals && !locals.isCollection) { | ||
@@ -53,23 +56,29 @@ opts = utils.merge({}, config, locals); | ||
// run `onLoad` middleware | ||
app.handleView('onLoad', file); | ||
app.handle('onLoad', file, function(err, view) { | ||
if (err) return next(err); | ||
// create the context to pass to templates | ||
var ctx = utils.merge({}, app.cache.data, locals, file.data); | ||
ctx.engine = resolveEngine(app, ctx, engine); | ||
debug('renderFile, preRender: %s', view.relative); | ||
if (!ctx.engine && app.option('engineStrict') === false) { | ||
next(null, file); | ||
return; | ||
} | ||
// create the context to pass to templates | ||
var ctx = utils.merge({}, app.cache.data, locals, view.data); | ||
ctx.engine = resolveEngine(app, ctx, engine); | ||
// render the file | ||
app.render(file, ctx, function(err, res) { | ||
if (err) { | ||
err.file = file; | ||
next(err); | ||
if (!ctx.engine && app.option('engineStrict') === false) { | ||
next(null, view); | ||
return; | ||
} | ||
if (engine) delete res.fn; | ||
next(null, res); | ||
// render the view | ||
app.render(view, ctx, function(err, res) { | ||
if (err) { | ||
err.view = view; | ||
next(err); | ||
return; | ||
} | ||
debug('renderFile, postRender: %s', view.relative); | ||
if (engine) delete res.fn; | ||
next(null, res); | ||
}); | ||
}); | ||
@@ -76,0 +85,0 @@ }); |
{ | ||
"name": "assemble-render-file", | ||
"description": "Assemble plugin for rendering views in a vinyl pipeline.", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"homepage": "https://github.com/jonschlinkert/assemble-render-file", | ||
@@ -24,22 +24,42 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"dependencies": { | ||
"debug": "^2.2.0", | ||
"lazy-cache": "^1.0.3", | ||
"mixin-deep": "^1.1.3", | ||
"through2": "^2.0.0" | ||
"through2": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"assemble-core": "^0.8.0", | ||
"assemble-core": "^0.12.1", | ||
"engine-base": "^0.1.2", | ||
"engine-handlebars": "^0.8.0", | ||
"gulp": "^3.9.0", | ||
"gulp-eslint": "^1.1.0", | ||
"gulp-istanbul": "^0.10.2", | ||
"gulp": "^3.9.1", | ||
"gulp-eslint": "^2.0.0", | ||
"gulp-format-md": "^0.1.7", | ||
"gulp-istanbul": "^0.10.3", | ||
"gulp-mocha": "^2.2.0", | ||
"mocha": "*", | ||
"should": "*" | ||
"mocha": "^2.4.5", | ||
"should": "^8.2.2" | ||
}, | ||
"keywords": [ | ||
"assemble", | ||
"assembleplugin" | ||
"assembleplugin", | ||
"engine", | ||
"file", | ||
"plugin", | ||
"render", | ||
"stream", | ||
"template", | ||
"view", | ||
"views", | ||
"vinyl" | ||
], | ||
"verb": { | ||
"run": true, | ||
"toc": "N", | ||
"layout": "default", | ||
"tasks": [ | ||
"readme" | ||
], | ||
"plugins": [ | ||
"gulp-format-md" | ||
], | ||
"related": { | ||
@@ -49,6 +69,14 @@ "list": [ | ||
"assemble-loader", | ||
"assemble-streams" | ||
"assemble-streams", | ||
"verb", | ||
"base" | ||
] | ||
}, | ||
"reflinks": [ | ||
"verb" | ||
], | ||
"lint": { | ||
"reflinks": true | ||
} | ||
} | ||
} | ||
} |
@@ -5,7 +5,4 @@ # 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) | ||
**Heads up!** | ||
## Install | ||
This requires the [assemble-vinyl](https://github.com/assemble/assemble-vinyl) plugin to work. | ||
## Install | ||
Install with [npm](https://www.npmjs.com/): | ||
@@ -61,7 +58,29 @@ | ||
## Related projects | ||
* [assemble](https://www.npmjs.com/package/assemble): Assemble is a powerful, extendable and easy to use static site generator for node.js. Used… [more](https://www.npmjs.com/package/assemble) | [homepage](https://github.com/assemble/assemble) | ||
* [assemble-loader](https://www.npmjs.com/package/assemble-loader): Assemble plugin (^0.6.0) for loading globs of views onto custom view collections. Also works with… [more](https://www.npmjs.com/package/assemble-loader) | [homepage](https://github.com/jonschlinkert/assemble-loader) | ||
* [assemble-streams](https://www.npmjs.com/package/assemble-streams): Assemble plugin that adds convenience methods for working with streams, like `toStream`, which pushes a… [more](https://www.npmjs.com/package/assemble-streams) | [homepage](https://github.com/jonschlinkert/assemble-streams) | ||
* [assemble-streams](https://www.npmjs.com/package/assemble-streams): Assemble pipeline plugin for pushing a view collection into a vinyl stream. | [homepage](https://github.com/assemble/assemble-streams) | ||
* [base](https://www.npmjs.com/package/base): base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… [more](https://www.npmjs.com/package/base) | [homepage](https://github.com/node-base/base) | ||
* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://www.npmjs.com/package/verb) | [homepage](https://github.com/verbose/verb) | ||
## Contributing | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/assemble-render-file/issues/new). | ||
## Building docs | ||
Generate readme and API documentation with [verb][]: | ||
```sh | ||
$ npm i -d && npm run docs | ||
``` | ||
Or, if [verb][] is installed globally: | ||
```sh | ||
$ verb | ||
``` | ||
## Running tests | ||
Install dev dependencies: | ||
@@ -73,17 +92,16 @@ | ||
## Contributing | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/assemble-render-file/issues/new). | ||
## Author | ||
## Author | ||
**Jon Schlinkert** | ||
+ [github/jonschlinkert](https://github.com/jonschlinkert) | ||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
* [github/jonschlinkert](https://github.com/jonschlinkert) | ||
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
## License | ||
Copyright © 2016 [Jon Schlinkert](https://github.com/jonschlinkert) | ||
Released under the MIT license. | ||
Released under the [MIT license](https://github.com/jonschlinkert/assemble-render-file/blob/master/LICENSE). | ||
*** | ||
_This file was generated by [verb](https://github.com/verbose/verb) on January 06, 2016._ | ||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on February 22, 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
8877
90
104
4
10
+ Addeddebug@^2.2.0
+ Addeddebug@2.6.9(transitive)
+ Addedms@2.0.0(transitive)
Updatedthrough2@^2.0.1