Jade: declare a variable over multiple lines
coding-style, pug
Solution
Jade now supports multineline variables, as described in the docs:
-
list = ["Uno", "Dos", "Tres",
"Cuatro", "Cinco", "Seis"]
each item in list
li= item
Problem
I have a jade variable declared like this: ``` BUTTONS = { more_blue: {caption: BUTTONS_CAPTIONS.more, style: BUTTONS_STYLES.blue}, more_red: {caption: BUTTONS_CAPTIONS.more, style: BUTTONS_STYLES.red}, see: {caption: BUTTONS_CAPTIONS.see, style: BUTTON_STYLE_PHOTOS}, see_photos: {caption: BUTTONS_CAPTIONS.see_photos, style: BUTTON_STYLE_PHOTOS}, program : {caption: BUTTONS_CAPTIONS.program, style: BUTTON_STYLE_PROGRAM}, see_program : {caption: BUTTONS_CAPTIONS.see_program, style: BUTTON_STYLE_PROGRAM} } ``` but I would like it to be more readable like this: ``` BUTTONS = { more_blue: {caption: BUTTONS_CAPTIONS.more, style: BUTTONS_STYLES.blue} , more_red: {caption: BUTTONS_CAPTIONS.more, style: BUTTONS_STYLES.red} , see: {caption: BUTTONS_CAPTIONS.see, style: BUTTON_STYLE_PHOTOS} , see_photos: {caption: BUTTONS_CAPTIONS.see_photos, style: BUTTON_STYLE_PHOTOS} , program : {caption: BUTTONS_CAPTIONS.program, style: BUTTON_STYLE_PROGRAM} , see_program : {caption: BUTTONS_CAPTIONS.see_program, style: BUTTON_STYLE_PROGRAM} } ``` but this code doesn't compile even if I add backslashes at the end of each line. Are there any workarounds?