diff --git a/builder/patternlab.js b/builder/patternlab.js index b4705deaf..aeb248cdc 100644 --- a/builder/patternlab.js +++ b/builder/patternlab.js @@ -479,7 +479,9 @@ var patternlab_engine = function (config) { var viewAllPathsPartialHtml = pattern_assembler.renderPattern(viewAllPathsTemplate, {'viewallpaths': JSON.stringify(patternlab.viewAllPaths)}); //render the patternlab template, with all partials - var patternlabSiteHtml = pattern_assembler.renderPattern(patternlabSiteTemplate, {}, { + var patternlabSiteHtml = pattern_assembler.renderPattern(patternlabSiteTemplate, { + defaultPattern: patternlab.config.defaultPattern || 'all' + }, { 'ishControls': ishControlsPartialHtml, 'patternNav': patternNavPartialHtml, 'patternPaths': patternPathsPartialHtml, diff --git a/config.json b/config.json index 187e8955d..4ed9d3ff7 100644 --- a/config.json +++ b/config.json @@ -26,6 +26,7 @@ "templates", "pages" ], + "defaultPattern": "all", "ignored-extensions" : ["scss", "DS_Store", "less"], "ignored-directories" : ["scss"], "debug": false, diff --git a/core/styleguide/js/styleguide.js b/core/styleguide/js/styleguide.js index 44adb6561..ce83f10d5 100644 --- a/core/styleguide/js/styleguide.js +++ b/core/styleguide/js/styleguide.js @@ -469,16 +469,18 @@ } // load the iframe source - var patternName = "all"; + var patternName = window.defaultPattern || "all"; var patternPath = ""; - var iFramePath = window.location.protocol+"//"+window.location.host+window.location.pathname.replace("index.html","")+"styleguide/html/styleguide.html"; + var iFramePath = window.location.protocol + "//" + window.location.host + window.location.pathname.replace("index.html","") + "styleguide/html/styleguide.html"; + + // if we were passed some url parameters, deal with it if ((oGetVars.p != undefined) || (oGetVars.pattern != undefined)) { patternName = (oGetVars.p != undefined) ? oGetVars.p : oGetVars.pattern; - patternPath = urlHandler.getFileName(patternName); - iFramePath = (patternPath != "") ? window.location.protocol+"//"+window.location.host+window.location.pathname.replace("index.html","")+patternPath : iFramePath; } if (patternName != "all") { + patternPath = urlHandler.getFileName(patternName); + iFramePath = (patternPath != "") ? window.location.protocol + "//" + window.location.host + window.location.pathname.replace("index.html","") + patternPath : iFramePath; document.getElementById("title").innerHTML = "Pattern Lab - "+patternName; history.replaceState({ "pattern": patternName }, null, null); } diff --git a/source/_patternlab-files/index.mustache b/source/_patternlab-files/index.mustache index 1688121dd..d98ce37d5 100644 --- a/source/_patternlab-files/index.mustache +++ b/source/_patternlab-files/index.mustache @@ -10,6 +10,7 @@ +
> @@ -21,7 +22,7 @@ - +