@@ -266,15 +266,11 @@ function buildFooterHTML(patternlab, patternPartial) {
266
266
267
267
function buildViewAllHTML ( patternlab , patterns , patternPartial ) {
268
268
269
- //console.log(patterns);
270
-
271
- // patterns.push({
272
- // "patternName": "awesome",
273
- // "patternLink": "00-atoms-01-global/index.html",
274
- // "patternPartial": "viewall-atoms-global",
275
- // "patternDesc": "<p>This is the description of the category.</p>\n",
276
- // "patternSectionSubtype": true
277
- // })
269
+ //attempt to find a subtype pattern before rendering
270
+ var subtypePattern = patternlab . subtypePatterns [ patternPartial ] ;
271
+ if ( subtypePattern ) {
272
+ patterns . unshift ( subtypePattern ) ;
273
+ } // confirm else scenario
278
274
279
275
var viewAllHTML = pattern_assembler . renderPattern ( patternlab . viewAll ,
280
276
{
@@ -297,14 +293,12 @@ function buildViewAllPages(mainPageHeadHtml, patternlab, patterns) {
297
293
for ( i = 0 ; i < patternlab . patterns . length ; i ++ ) {
298
294
299
295
var pattern = patternlab . patterns [ i ] ;
300
- console . log ( 1 , pattern . patternPartial ) ;
301
296
302
297
// skip underscore-prefixed files
303
298
if ( isPatternExcluded ( pattern ) ) {
304
299
if ( patternlab . config . debug ) {
305
300
console . log ( 'Omitting ' + pattern . patternPartial + " from view all rendering." ) ;
306
301
}
307
- console . log ( '2 pattern excluded' ) ;
308
302
continue ;
309
303
}
310
304
@@ -313,7 +307,6 @@ function buildViewAllPages(mainPageHeadHtml, patternlab, patterns) {
313
307
if ( patternlab . config . debug ) {
314
308
console . log ( 'Omitting ' + pattern . patternPartial + ' from view all rendering because it is defined as a defaultPattern' ) ;
315
309
}
316
- console . log ( '3 pattern excluded' ) ;
317
310
continue ;
318
311
}
319
312
@@ -322,17 +315,14 @@ function buildViewAllPages(mainPageHeadHtml, patternlab, patterns) {
322
315
if ( pattern . patternGroup !== prevGroup ) {
323
316
prevGroup = pattern . patternGroup ;
324
317
325
- console . log ( '4 comparing ' , pattern . patternGroup , 'to' , prevGroup ) ;
326
318
327
319
var viewAllPatterns = [ ] ;
328
320
var patternPartial = "viewall-" + pattern . patternGroup ;
329
321
var j ;
330
322
331
- console . log ( 'built' + patternPartial ) ;
332
323
333
324
for ( j = 0 ; j < patternlab . patterns . length ; j ++ ) {
334
325
335
- console . log ( '5 comparing ' , patternlab . patterns [ j ] . patternGroup , 'to' , pattern . patternGroup ) ;
336
326
337
327
if ( patternlab . patterns [ j ] . patternGroup === pattern . patternGroup ) {
338
328
//again, skip any sibling patterns to the current one that may have underscores
@@ -341,7 +331,6 @@ function buildViewAllPages(mainPageHeadHtml, patternlab, patterns) {
341
331
if ( patternlab . config . debug ) {
342
332
console . log ( 'Omitting ' + patternlab . patterns [ j ] . patternPartial + " from view all sibling rendering." ) ;
343
333
}
344
- console . log ( '6 pattern excluded' ) ;
345
334
continue ;
346
335
}
347
336
@@ -350,11 +339,9 @@ function buildViewAllPages(mainPageHeadHtml, patternlab, patterns) {
350
339
if ( patternlab . config . debug ) {
351
340
console . log ( 'Omitting ' + pattern . patternPartial + ' from view all sibling rendering because it is defined as a defaultPattern' ) ;
352
341
}
353
- console . log ( '7 pattern excluded' ) ;
354
342
continue ;
355
343
}
356
344
357
- console . log ( '8 adding ' , patternlab . patterns [ j ] . patternPartial , ' to viewAllPatterns' ) ;
358
345
359
346
viewAllPatterns . push ( patternlab . patterns [ j ] ) ;
360
347
}
@@ -369,10 +356,6 @@ function buildViewAllPages(mainPageHeadHtml, patternlab, patterns) {
369
356
fs . outputFileSync ( paths . public . patterns + pattern . subdir . slice ( 0 , pattern . subdir . indexOf ( pattern . patternGroup ) + pattern . patternGroup . length ) + '/index.html' , mainPageHeadHtml + viewAllHTML + footerHTML ) ;
370
357
}
371
358
372
- console . log ( '9 same group, checking subgroup' ) ;
373
-
374
- console . log ( '10 comparing ' , pattern . subdir , 'to' , prevSubdir ) ;
375
-
376
359
//create the view all for the subsection
377
360
// check if the current sub section is different from the previous one
378
361
if ( pattern . subdir !== prevSubdir ) {
@@ -381,19 +364,14 @@ function buildViewAllPages(mainPageHeadHtml, patternlab, patterns) {
381
364
viewAllPatterns = [ ] ;
382
365
patternPartial = "viewall-" + pattern . patternGroup + "-" + pattern . patternSubGroup ;
383
366
384
- console . log ( '11 built ' , patternPartial ) ;
385
-
386
367
for ( j = 0 ; j < patternlab . patterns . length ; j ++ ) {
387
368
388
- console . log ( '12 comparing ' , patternlab . patterns [ j ] . subdir , 'to' , pattern . subdir ) ;
389
-
390
369
if ( patternlab . patterns [ j ] . subdir === pattern . subdir ) {
391
370
//again, skip any sibling patterns to the current one that may have underscores
392
371
if ( isPatternExcluded ( patternlab . patterns [ j ] ) ) {
393
372
if ( patternlab . config . debug ) {
394
373
console . log ( 'Omitting ' + patternlab . patterns [ j ] . patternPartial + " from view all sibling rendering." ) ;
395
374
}
396
- console . log ( '13 pattern excluded' ) ;
397
375
continue ;
398
376
}
399
377
@@ -402,17 +380,12 @@ function buildViewAllPages(mainPageHeadHtml, patternlab, patterns) {
402
380
if ( patternlab . config . debug ) {
403
381
console . log ( 'Omitting ' + pattern . patternPartial + ' from view all sibling rendering because it is defined as a defaultPattern' ) ;
404
382
}
405
- console . log ( '14 pattern excluded' ) ;
406
383
continue ;
407
384
}
408
385
409
- console . log ( '15 adding ' , patternlab . patterns [ j ] . patternPartial , ' to viewAllPatterns' ) ;
410
-
411
386
viewAllPatterns . push ( patternlab . patterns [ j ] ) ;
412
387
}
413
388
414
- console . log ( '16 fell through!' ) ;
415
-
416
389
}
417
390
418
391
//render the footer needed for the viewall template
@@ -421,11 +394,7 @@ function buildViewAllPages(mainPageHeadHtml, patternlab, patterns) {
421
394
//render the viewall template
422
395
var viewAllHTML = buildViewAllHTML ( patternlab , viewAllPatterns , patternPartial ) ;
423
396
424
- console . log ( '17 writing view all file ' , pattern . flatPatternPath ) ;
425
-
426
397
fs . outputFileSync ( paths . public . patterns + pattern . flatPatternPath + '/index.html' , mainPageHeadHtml + viewAllHTML + footerHTML ) ;
427
- } else {
428
- console . log ( '18 fell through!' ) ;
429
398
}
430
399
}
431
400
}
@@ -483,8 +452,6 @@ function buildFrontEnd(patternlab) {
483
452
484
453
//build the styleguide
485
454
486
- fs . outputFileSync ( './patternlab-s.json' , JSON . stringify ( styleguidePatterns ) ) ;
487
-
488
455
var styleguideHtml = pattern_assembler . renderPattern ( patternlab . viewAll ,
489
456
{
490
457
partials : styleguidePatterns ,
0 commit comments