I'm trying to use a var declared in my _layout.jade within my _header.jade, but its returning undefined. It works when I output it directly in _layout, but I've read that jade partials should inherit vars from the file that included them. Am I not doing it right, or is it a limitation specific to Harp?
The specific purpose I have is to set a path variable for links and meta assets (like icons), to use an absolute root (using the uri global) in production and just a / while in development.
e.g. In layout
- var path = (environment == "production") ? uri + '/' : '/'
I'm trying to use a var declared in my _layout.jade within my _header.jade, but its returning undefined. It works when I output it directly in _layout, but I've read that jade partials should inherit vars from the file that included them. Am I not doing it right, or is it a limitation specific to Harp?
The specific purpose I have is to set a
path
variable for links and meta assets (like icons), to use an absolute root (using the uri global) in production and just a/
while in development.e.g. In layout
- var path = (environment == "production") ? uri + '/' : '/'
then something like this in my header partial
link(rel="icon" type="image/png" href="#{ path }img/favicon-32x32.png" sizes="32x32")
Any ideas?