Get quicker at creating repeating elements with Jade
Sometimes when prototyping, we may just need the tags to repeat themselves without any content inside them, so that we create something out of them just through plain css.
Example
ul
  li
  li
  liWith jade you have to write
ul
each i in [1, 2, 3]
  liWhat if say, you need an arbitrarily large number of repeating elements?
Instead of writing [1,2,3,4,....]
You can code
ul
each i in new Array(10)
  liThis will get you 10 li elements (but the value of i for every element will be undefined).
Written by Arijit Bhattacharya
Related protips
1 Response
 
You can also use one of the mxins I've written at https://coderwall.com/p/3fgarg
+times(10)
  li
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
 #Templates 
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#

 
 
 
