Rabehaja Harivola Loic
Rabehaja Harivola Loic

Reputation: 144

How to declare global variable with pug/jade

I am totally new in the jade/pug thing and I am now playing around and discovering this new technology. So far so good but somehow I do not know how do I define global variables to be use for all of my solution.

It kinda looks like this.

I have my mixins as below

mixin headerSearch(projectName)
ul.navbar-search
    li
    a(href="#",class=projectName + "-menu-icon" + projectName + "-menubar-search", id="open-search-form")
        span.sr-only Search
        span.icon.icon-search


mixin headerNavigationIcons(navigationIconList,projectName)
ul.navbar-icons
    each navigationIcon in navigationIconList.length  ? navigationIconList : ["account","wishlist","carte"]
        li(class="menubar-"+ navigationIcon)
            a(href="#",class=projectName+"-hidden-text")
                span.heracles-hidden-text=navigationIcon

I would like to set the projectName variable to a global one so I can change it according to my projects.

How to do so?

Please help

Upvotes: 3

Views: 2803

Answers (1)

Rabehaja Harivola Loic
Rabehaja Harivola Loic

Reputation: 144

Finally found my answer after playing around a bit with it.

Setting a global variable can be done by using the option attribute in the pug-cli.

I don't know if it the best way to do so but it works.

Upvotes: 2

Related Questions