R
R
ravshan selimov2020-10-15 19:36:53
Pug
ravshan selimov, 2020-10-15 19:36:53

What is the correct way to use multiline array or object literals in PUG template engine?

I can't create an array of objects in pug.
Either the error is `unexpected text "{"`, then it swears that spaces, tabs are not correct.
What are the ad rules?

Code (not working)

- let works = [ 
        {
          image : '/assets/images/works/paint-app.jpg',
          text  : Paint App,
          link  : '/projects/paint-app/index.html'
        },
        {
          image : '/assets/images/works/color-generator.png',
          text  : 'Color Generator',
          link  : '/projects/color-generator/index.html'
        },		
        {
          image : '/assets/images/works/shulte-table.jpg',
          text  : 'Shulte Table',
          link  : '/projects/schulte-table/index.html'
        },	
        {
          image : '/assets/images/works/mental-trainers.png',
          text  : 'Mental Trainers',
          link  : 'https://ravshan01.gitlab.io' 
        }
    ];


Tried not only this way, in different ways, it still does not work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-10-15
@ravshan01

Instead
- let works = [
it should be

-
  let works = [

They also forgot the quotes - the zero element of the array, the value of the text property.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question