L
L
lavezzi12015-10-12 03:38:03
JavaScript
lavezzi1, 2015-10-12 03:38:03

How to use Jade in my case?

Hello!
I want to understand how to use jade in my case.
I'm building a website on the bootstrap, there are two navigations (top and right).
There are many pages (there are typical ones, but the content on each page is different).
The contents of the menus are also different depending on the pages.
Please tell me what exactly to use, extends, block, include and in what cases. Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jlekapb, 2015-10-12
@jlekapb

I would write the menu in a json file and display it according to the condition.
layout.jade

include ../helpers/mixins
html
    body
        block menu
            if menuID === 1
                +menu(1)
        block content

page1.jade
extends ../layouts/layout
block menu
    - var menuID = 1;
block content
    p Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod

mixins.jade
//- тут создаете миксин, который принимает аргумент и выводит по нему часть json.
+menu(menuID)

ps. if there are a lot of pages, it may make sense to put each page in a folder in which the menu for this page will be located.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question