jstransformers / jstransformer

Normalize the API of any JSTransformer.
http://npm.im/jstransformer
MIT License
153 stars 12 forks source link

Engine Options #172

Open RobLoach opened 7 years ago

RobLoach commented 7 years ago

Many template engines use environment options. These are options that are applies to all calls to .render() or .compile(), outside of the given options parameter. In Twig, these could be considered something like extending Twig.

In a JSTransformers land, this could be thought of as something like this:

var options = {
  cache: false,
  strict_variables: false
}
var jstransformers = require('jstransformers')
var jstwig = require('jstransformer-twig')(options)
var twig = jstransformers(jstwig)

Alternatively, we could do something to keep the singleton pattern and API that we're using currently:

var options = {
  cache: false,
  strict_variables: false
}
var jstransformers = require('jstransformers')
var jstwig = require('jstransformer-twig')
jstwig.options(options)
var twig = jstransformers(jstwig)

Thoughts?