Skip to content

Inherit layout vars in partials #72

@timkinnane

Description

@timkinnane

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions