D
D
Dmitry Sergeevich2015-10-26 11:07:04
Pug
Dmitry Sergeevich, 2015-10-26 11:07:04

How to display Jade block in index.html in a loop?

Hello! I decided to finally start using Jade for layout of html files.
I immediately ran into the problem of outputting a block in a loop. Previously, I just used this construction to display blocks of the same type:

<?php
$n = 6;
  for ($i=0; $i < $n; $i++) { 
  include('assets/item-n.html');
}
?>

After digging through the docs, I realized that in my case, include should be replaced with extend. But how to display it in a cycle, I did not figure it out. It would be ideal if someone explained how to generate unique content in these blocks.

Answer the question

In order to leave comments, you need to log in

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

upd. solution:
codepen.io/lkp/pen/avYqzq?editors=110
Didn't understand your example, what do you want to do?
How extends works:
jade-lang.com/reference/extends

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question