Is it's possible to make modular pug template in vibed?
    Steven Schveighoffer via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Tue Aug  8 06:34:10 PDT 2017
    
    
  
On 8/8/17 9:19 AM, Suliman wrote:
> Still can't get it work.
> 
> include header
> ..MainContainer
> ..Header
>    .HeaderMenu
>      .HeaderBlock
>        a(href="/") General
>      .HeaderBlock
>        a(href="/FAQ") FAQ
>      .HeaderBlock
>        a(href="/book") Book
>    .HeaderLoginBlock Sign in
> ..Middle
>    foooo
> include footer
OK, you aren't thinking of this correctly then, each pug/diet file must 
be complete. It's not like C preprocessor where the structure can be 
played with via includes or macros.
That is, .MainContainer cannot be a child under something defined in header.
In this case, you need to use the block system.
> it's template is compilable, but it have wrong indent. Original page 
> (that I am trying to split) have next indents:
> 
> doctype html
> html
>    head
>      title DLANG.ru
>    body
>      #app
>        .MainContainer
>          .Header
>            .HeaderMenu
>              .HeaderBlock
>                router-link(to='/') General
>              .HeaderBlock
>                router-link(to='/FAQ') FAQ
>              .HeaderBlock
>                router-link(to='/book') Book
>            .HeaderLoginBlock Sign in
>          .Middle
>            foooo
>          .footer (c) DLANG 2017
> 
> But I can't get right indents when I am splition it.
So what you want is probably like:
layout.dt:
doctype html
html
    head
       title DLANG.ru
    body
       #app
          .MainContainer
             block contents
             .footer (c) DLANG 2017
myfile.dt:
extends layout
block contents
    .Header
       .HeaderMenu
          .HeaderBlock
             router-link(to='/') General
          .HeaderBlock
             router-link(to='/FAQ') FAQ
          .HeaderBlock
             router-link(to='/book') Book
       .HeaderLoginBlock Sign in
    .Middle
       foooo
-Steve
    
    
More information about the Digitalmars-d-learn
mailing list