Is it possible to access some global variable (or module) through swig? I have some logic units, which I use in many views, so I've made special module containing object with common "configuration" data:
var school = {
logic_units: {
1: "1. unit...",
2: "2. unit...",
3: "3. unit...",
4: "4. unit..."
},
...
};
module.exports = drivingSchool;
But, always when I'm rendering from controller, I need to care to send object with logic_units, like:
...
res.render('view.html', {units: require('configuration')};
and then I can use it normally as {{ units["1"] }}
or such.
Is it possible to retrieve units directly in swig template, without needing to pass the object while rendering?