J
J
Junior-web2021-06-11 18:49:58
Pug
Junior-web, 2021-06-11 18:49:58

Why don't extends and block and variables work in pug?

Good afternoon,
there are two blocks, their pug files are located in different folders
-- src/phone/phone.pug

.phone.d-flex
    span.phone__icon
        i.fa.fa-phone(aria-hidden='true')
    .phone__container
        a(class=`phone__link#{phonelink}` href='tel:455') 455
       block communicate


-- src/communicate/communicate.pug

extends ../phone/phone.pug

block communicate
span.communicate.d-flex
    a.communicate__whatsapp(href='')
        img(src='images/social/whatsapp.svg' alt='whatsapp')
    a(href='communicate__telegram')
        img(src='images/social/telegram.svg' alt='telegram')
    a(href='communicate__viber')
        img(src='images/social/viber.svg' alt='viber')


The compilation passes, but the communicate block in the phone file is not expanded.
Too and with variables - do not work.

For example, in the first file I write:
block variables
         - var test = "Test";
     include "../communicate/communicate.pug"

then this variable is not visible in the second file. This entry #{test} is displayed as it should be, not the content. Or is that not how it works?

PS: please advise whether to use pug, I thought it was convenient, you can break the code into blocks, and not look at the code canvas, but it takes a lot of time to figure it out. Maybe there is a possibility of a similar implementation of regular html?
Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question