Jade/PUG - Global variables
PatrickJongmans opened this issue · 2 comments
PatrickJongmans commented
Is it possible to use the global variables in Jade/Pug? (We have rewritten the Jade version to Pug)
exports.install = function(){
F.global.some_var = "some value";
F.route("/dashboard", dashboard, ['authorize']);
});
function some_view(){
model = {'title' : 'Title'};
self.view('someview', model);
}
Jade/Pug:
h1= title
div.somediv= global.some_var
PatrickJongmans commented
As a (temporary) fix we added the global vars like this:
model.global = framework.global;
var fn = pug.compile(fs.readFileSync(path).toString('utf8'), options);
petersirka commented
Hi @PatrickJongmans,
I have added pug view with model.global
.
Thank you!