Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherit layout vars in partials #72

Open
timkinnane opened this issue May 21, 2016 · 0 comments
Open

Inherit layout vars in partials #72

timkinnane opened this issue May 21, 2016 · 0 comments

Comments

@timkinnane
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant