rewrite: add footer deferrred scripts, plus middwlare for sending node
envs to jade