A
A
Alexandr Mi2017-11-02 17:42:24
Pug
Alexandr Mi, 2017-11-02 17:42:24

How to do a line break in PUG (Jade) code?

I create an array in PUG

Если писать все в 1 строку:
- var app = [{demoImg : 'images/App_L.jpg',basic: ['HTML','SASS', 'Jquery'], libraries: ['Font Awesome', 'Scrollreveal.js', 'Section-scroll.js', 'Slick.js'], assembly: ['Gulp', 'Bower']},{demoImg : 'images/lambdaApp_L.jpg',basic: ['HTML','SASS', 'Jquery'], libraries: ['Font Awesome', 'Scrollreveal.js', 'Section-scroll.js', 'Slick.js'], assembly: ['Gulp', 'Bower']}];
то компилируется и работает.

Если попытаться облагородить код:
- var app = [
  {
    demoImg : 'images/lambdaApp_L.jpg',
    basic: ['HTML','SASS', 'Jquery'],
    libraries: ['Font Awesome', 'Scrollreveal.js', 'Section-scroll.js', 'Slick.js'],
    assembly: ['Gulp', 'Bower'],
  }
];
выдает ошибку -  "unexpected text {"

Trying to remove all spaces and tabs didn't work...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Kitmanov, 2017-11-02
@missing00

See "Block unbuffered code" example: https://pugjs.org/language/code.html#unbuffered-code

A
Anton HolopOFF, 2021-12-29
@an1984ton

Alternatively
// Multi-line entry
-
menu = [
{
href: '#main',
page: 'Main'
},
{
page: "Directory",
href: "#",
sub: [
{
href: "#2",
page : "Submenu 1"
},
{
href: "#3",
page: "Submenu 2"
},
{
href: "#4",
page: "Submenu 3"
}
]
},
{
href: "#about",
page : "About Us"
},
{
href: "https://mediarama.by/ ",
page: "Website development"
},
{
href: "#contacts",
page: "Contacts"
}
]
61ccbf3dca102322155046.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question