File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -244,6 +244,19 @@ var pattern_assembler = function () {
244244
245245 function processPatternIterative ( relPath , patternlab ) {
246246
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+
247260 //check if the found file is a top-level markdown file
248261 var fileObject = path . parse ( relPath ) ;
249262 if ( fileObject . ext === '.md' ) {
Original file line number Diff line number Diff line change @@ -500,9 +500,13 @@ var ui_builder = function () {
500500 //todo this isn't quite working yet
501501 //typePatterns = typePatterns.concat(getPatternItems(patternlab, patternType));
502502
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
504508 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 ) ;
506510
507511 //determine if we should omit this patterntype completely from the viewall page
508512 var omitPatternType = styleGuideExcludes && styleGuideExcludes . length
You can’t perform that action at this time.
0 commit comments