diff --git a/core/lib/pattern_assembler.js b/core/lib/pattern_assembler.js index 1eb5b6fda..f895e6a93 100644 --- a/core/lib/pattern_assembler.js +++ b/core/lib/pattern_assembler.js @@ -244,6 +244,19 @@ var pattern_assembler = function () { function processPatternIterative(relPath, patternlab) { + var relativeDepth = relPath.match(/\w(?=\\)|\w(?=\/)/g || []).length; + if (relativeDepth > 2) { + console.log(''); + plutils.logOrange('Warning:'); + plutils.logOrange('A pattern file: ' + relPath + ' was found greater than 2 levels deep from ' + patternlab.config.paths.source.patterns + '.'); + plutils.logOrange('It\'s strongly suggested to not deviate from the following structure under _patterns/'); + plutils.logOrange('[patternType]/[patternSubtype]/[patternName].[patternExtension]'); + console.log(''); + plutils.logOrange('While Pattern Lab may still function, assets may 404 and frontend links may break. Consider yourself warned. '); + plutils.logOrange('Read More: http://patternlab.io/docs/pattern-organization.html'); + console.log(''); + } + //check if the found file is a top-level markdown file var fileObject = path.parse(relPath); if (fileObject.ext === '.md') { diff --git a/core/lib/ui_builder.js b/core/lib/ui_builder.js index 77f94c84c..3d41acea5 100644 --- a/core/lib/ui_builder.js +++ b/core/lib/ui_builder.js @@ -500,9 +500,13 @@ var ui_builder = function () { //todo this isn't quite working yet //typePatterns = typePatterns.concat(getPatternItems(patternlab, patternType)); - //render the viewall template + //get the appropriate patternType + var anyPatternOfType = _.find(typePatterns, function (pat) { + return pat.patternType && pat.patternType !== '';}); + + //render the viewall template for the type var viewAllHTML = buildViewAllHTML(patternlab, typePatterns, patternType); - writeFile(paths.public.patterns + p.subdir + '/index.html', mainPageHeadHtml + viewAllHTML + footerHTML); + writeFile(paths.public.patterns + anyPatternOfType.patternType + '/index.html', mainPageHeadHtml + viewAllHTML + footerHTML); //determine if we should omit this patterntype completely from the viewall page var omitPatternType = styleGuideExcludes && styleGuideExcludes.length