dimanche 29 mars 2015

Jade - Include var from an external js file?

Jade newbie here.


I'm aware that in Jade you are allowed to create js variables and interpolate them in seamlessly with html like so:



- var myname = "john"
p my name is #{myname}


However what if that variable were to come from an external .js file (or, if impossible, an external .jade file)?


file.js:



var myname = "john";


and then the index.jade:



- include file.js
p my name is #{myname} //this does not work


I'm not sure whether the render function has anything to do with this. If someone could be so generous as to explain this in plain English, it would be greatly appreciated.


Aucun commentaire:

Enregistrer un commentaire