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)
Many template engines use environment options. These are options that are applies to all calls to
.render()
or.compile()
, outside of the givenoptions
parameter. In Twig, these could be considered something like extending Twig.In a JSTransformers land, this could be thought of as something like this:
Alternatively, we could do something to keep the singleton pattern and API that we're using currently:
Thoughts?