Balázs Orbán Balázs Orbán - 2 months ago 18
Jade Question

Jade variable in variable

I have a .jade file with only variables. One of them is a variable which begins with a variable defined before it.

example:

My variables.jade file:

- var baseurl = 'http://example.com'
- var assets = baserurl+'/assets'
- var images = assets+'/images'


My main.jade file:

include variables
img(src=images+'/1.jpg')


The html will be:

<img src='undefined/assets/images/1.jpg'>


Why does the baseurl appear as undefined?

Answer

typo in baserurl. it should be baseurl