paypal/kraken-js — pull request #116 by pvenkatakrishnan (2014-02-04 02:47:10+00:00)
Title: Specialization : 

Including template specialization before the middleware set in app.engine() is invoked, during every res.render.
If 'specialization' is specified in the app config,
the change,
1. generates a template map of specialized templates for that render context
2. stashes the map in the context under _specialization property

From there on the workflow is the same as before.
Will add more details when all the changes are PRed.
****** DO NOT MERGE THIS PR YET *****
NEEDS PR TO MAKARA + KARKA MODULES TO WORK but will not break if merged as I do check for existence of the dependent rule parsing module. If not present will ignore the piece of code added below.

For the outside world who does not know yet what specialization work is for:
It is a mechanism to dynamically change views rendered in a specific context based on a rule set that can be specified in the app's config. A rule parser will evaluate the render context against the rules and decide which partial needs to be picked for the context.
This will be evaluated on every res.render('view', data)

Some use cases would be:
* A/B test a feature
* use different templates for different locales
* Render different views based on the device the page is loaded
... and many more.