File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,19 @@ var pattern_assembler = function () {
244
244
245
245
function processPatternIterative ( relPath , patternlab ) {
246
246
247
+ var relativeDepth = relPath . match ( / \w (? = \\ ) | \w (? = \/ ) / g || [ ] ) . length ;
248
+ if ( relativeDepth > 2 ) {
249
+ console . log ( '' ) ;
250
+ plutils . logOrange ( 'Warning:' ) ;
251
+ plutils . logOrange ( 'A pattern file: ' + relPath + ' was found greater than 2 levels deep from ' + patternlab . config . paths . source . patterns + '.' ) ;
252
+ plutils . logOrange ( 'It\'s strongly suggested to not deviate from the following structure under _patterns/' ) ;
253
+ plutils . logOrange ( '[patternType]/[patternSubtype]/[patternName].[patternExtension]' ) ;
254
+ console . log ( '' ) ;
255
+ plutils . logOrange ( 'While Pattern Lab may still function, assets may 404 and frontend links may break. Consider yourself warned. ' ) ;
256
+ plutils . logOrange ( 'Read More: http://patternlab.io/docs/pattern-organization.html' ) ;
257
+ console . log ( '' ) ;
258
+ }
259
+
247
260
//check if the found file is a top-level markdown file
248
261
var fileObject = path . parse ( relPath ) ;
249
262
if ( fileObject . ext === '.md' ) {
Original file line number Diff line number Diff line change @@ -500,9 +500,13 @@ var ui_builder = function () {
500
500
//todo this isn't quite working yet
501
501
//typePatterns = typePatterns.concat(getPatternItems(patternlab, patternType));
502
502
503
- //render the viewall template
503
+ //get the appropriate patternType
504
+ var anyPatternOfType = _ . find ( typePatterns , function ( pat ) {
505
+ return pat . patternType && pat . patternType !== '' ; } ) ;
506
+
507
+ //render the viewall template for the type
504
508
var viewAllHTML = buildViewAllHTML ( patternlab , typePatterns , patternType ) ;
505
- writeFile ( paths . public . patterns + p . subdir + '/index.html' , mainPageHeadHtml + viewAllHTML + footerHTML ) ;
509
+ writeFile ( paths . public . patterns + anyPatternOfType . patternType + '/index.html' , mainPageHeadHtml + viewAllHTML + footerHTML ) ;
506
510
507
511
//determine if we should omit this patterntype completely from the viewall page
508
512
var omitPatternType = styleGuideExcludes && styleGuideExcludes . length
You can’t perform that action at this time.
0 commit comments