From express i pass the variable locals to the template engine like this:
res.render("Main.pug",locals);
I can use the variable inside the template engine. But i also want to use it inside the included script file
script(src='/file/Index.js')
i have tried following,
script(src='/file/Index.js')
| var myVar = "Hello";
But not working.
Now its working,
Needs to be above any other script files
inside Index.js:
And if you want to use variable passed from express to script file use: