From 207eb5b4e5181ff6bdeadec1cb2066d60e924de0 Mon Sep 17 00:00:00 2001 From: Salem Ghoweri Date: Sat, 21 Jul 2018 11:26:14 -0400 Subject: [PATCH 1/6] refactor: port over Twig partials from Styleguidekit Twig Default's repo, updating to match more recent UIkit JS and CSS updates --- packages/uikit-workshop/views-twig/README | 1 + .../views-twig/partials/general-footer.twig | 56 +++++++++++++++++++ .../views-twig/partials/general-header.twig | 1 + .../views-twig/partials/patternSection.twig | 34 +++++++++++ .../partials/patternSectionSubtype.twig | 11 ++++ .../uikit-workshop/views-twig/viewall.twig | 13 +++++ 6 files changed, 116 insertions(+) create mode 100755 packages/uikit-workshop/views-twig/README create mode 100755 packages/uikit-workshop/views-twig/partials/general-footer.twig create mode 100755 packages/uikit-workshop/views-twig/partials/general-header.twig create mode 100755 packages/uikit-workshop/views-twig/partials/patternSection.twig create mode 100755 packages/uikit-workshop/views-twig/partials/patternSectionSubtype.twig create mode 100755 packages/uikit-workshop/views-twig/viewall.twig diff --git a/packages/uikit-workshop/views-twig/README b/packages/uikit-workshop/views-twig/README new file mode 100755 index 000000000..14208f4c9 --- /dev/null +++ b/packages/uikit-workshop/views-twig/README @@ -0,0 +1 @@ +There should be no reason to touch these files in day-to-day use. \ No newline at end of file diff --git a/packages/uikit-workshop/views-twig/partials/general-footer.twig b/packages/uikit-workshop/views-twig/partials/general-footer.twig new file mode 100755 index 000000000..aca705d9c --- /dev/null +++ b/packages/uikit-workshop/views-twig/partials/general-footer.twig @@ -0,0 +1,56 @@ + + + + + + + diff --git a/packages/uikit-workshop/views-twig/partials/general-header.twig b/packages/uikit-workshop/views-twig/partials/general-header.twig new file mode 100755 index 000000000..6a74a9766 --- /dev/null +++ b/packages/uikit-workshop/views-twig/partials/general-header.twig @@ -0,0 +1 @@ + diff --git a/packages/uikit-workshop/views-twig/partials/patternSection.twig b/packages/uikit-workshop/views-twig/partials/patternSection.twig new file mode 100755 index 000000000..e085c40c4 --- /dev/null +++ b/packages/uikit-workshop/views-twig/partials/patternSection.twig @@ -0,0 +1,34 @@ +
+ + + +
+ +
+ {{ partial.patternPartialCode | raw }} +
+ + + +
diff --git a/packages/uikit-workshop/views-twig/partials/patternSectionSubtype.twig b/packages/uikit-workshop/views-twig/partials/patternSectionSubtype.twig new file mode 100755 index 000000000..ce449c607 --- /dev/null +++ b/packages/uikit-workshop/views-twig/partials/patternSectionSubtype.twig @@ -0,0 +1,11 @@ +
+ +

+ {{ partial.patternName }} +

+ +
+ {{ partial.patternDesc | raw }} +
+ +
diff --git a/packages/uikit-workshop/views-twig/viewall.twig b/packages/uikit-workshop/views-twig/viewall.twig new file mode 100755 index 000000000..42656abed --- /dev/null +++ b/packages/uikit-workshop/views-twig/viewall.twig @@ -0,0 +1,13 @@ + +
+ +
+ {% for partial in partials %} + {% if partial.patternSectionSubtype %} + {% include "@uikit/patternSectionSubtype.twig" %} + {% else %} + {% include "@uikit/patternSection.twig" %} + {% endif %} + {% endfor %} +
+
From 52d0d978e7ff6dc93d739da8c1c4aaf539a77dbe Mon Sep 17 00:00:00 2001 From: Salem Ghoweri Date: Sat, 21 Jul 2018 11:28:46 -0400 Subject: [PATCH 2/6] refactor: add @pattern-lab/starterkit-twig-demo as a dependency to test Twig PHP compiles properly; update demo config to point at assets for the time being --- packages/edition-twig/package-lock.json | 13 +++++++++ packages/edition-twig/package.json | 4 +-- packages/edition-twig/patternlab-config.json | 30 ++++++++++---------- 3 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 packages/edition-twig/package-lock.json diff --git a/packages/edition-twig/package-lock.json b/packages/edition-twig/package-lock.json new file mode 100644 index 000000000..cb30f303e --- /dev/null +++ b/packages/edition-twig/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "@pattern-lab/edition-twig", + "version": "3.0.0-alpha.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@pattern-lab/starterkit-twig-demo": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@pattern-lab/starterkit-twig-demo/-/starterkit-twig-demo-4.0.0.tgz", + "integrity": "sha512-GDSKRgDT4BugTcEDRv3oH0+Lc9sUHWbUS6L1GPsLHr5PsJ/AdGdQOqTfrePZJMq2d/4xxGxQLAH2Ua6wagg0eg==" + } + } +} diff --git a/packages/edition-twig/package.json b/packages/edition-twig/package.json index 5c389c034..98aefd27d 100644 --- a/packages/edition-twig/package.json +++ b/packages/edition-twig/package.json @@ -23,9 +23,9 @@ "dependencies": { "@pattern-lab/cli": "^0.0.1-alpha.19", "@pattern-lab/core": "^3.0.0-alpha.13", - "@pattern-lab/engine-mustache": "^2.0.0-alpha.6", "@pattern-lab/engine-twig-php": "^0.1.0", - "@pattern-lab/uikit-workshop": "^1.0.0-alpha.5" + "@pattern-lab/uikit-workshop": "^1.0.0-alpha.5", + "@pattern-lab/starterkit-twig-demo": "^4.0.0" }, "engines": { "node": ">=6.0" diff --git a/packages/edition-twig/patternlab-config.json b/packages/edition-twig/patternlab-config.json index 4c6b2358a..90a028730 100644 --- a/packages/edition-twig/patternlab-config.json +++ b/packages/edition-twig/patternlab-config.json @@ -6,42 +6,42 @@ "id": "atoms", "recursive": true, "paths": [ - "source/_patterns/00-atoms" + "./node_modules/@pattern-lab/starterkit-twig-demo/dist/_patterns/00-atoms" ] }, { "id": "molecules", "recursive": true, "paths": [ - "source/_patterns/01-molecules" + "./node_modules/@pattern-lab/starterkit-twig-demo/dist/_patterns/01-molecules" ] }, { "id": "organisms", "recursive": true, "paths": [ - "source/_patterns/02-organisms" + "./node_modules/@pattern-lab/starterkit-twig-demo/dist/_patterns/02-organisms" ] }, { "id": "templates", "recursive": true, "paths": [ - "source/_patterns/03-templates" + "./node_modules/@pattern-lab/starterkit-twig-demo/dist/_patterns/03-templates" ] }, { "id": "pages", "recursive": true, "paths": [ - "source/_patterns/04-pages" + "./node_modules/@pattern-lab/starterkit-twig-demo/dist/_patterns/04-pages" ] }, { "id": "macros", "recursive": true, "paths": [ - "source/_macros" + "./node_modules/@pattern-lab/starterkit-twig-demo/dist/_macros" ] } ], @@ -94,11 +94,11 @@ }, "paths": { "source": { - "root": "./source/", - "patterns": "./source/_patterns/", - "data": "./source/_data/", - "meta": "./source/_meta/", - "annotations": "./source/_annotations/", + "root": "./node_modules/@pattern-lab/starterkit-twig-demo/dist/", + "patterns": "./node_modules/@pattern-lab/starterkit-twig-demo/dist/_patterns/", + "data": "./node_modules/@pattern-lab/starterkit-twig-demo/dist/_data/", + "meta": "./node_modules/@pattern-lab/starterkit-twig-demo/dist/_meta/", + "annotations": "./node_modules/@pattern-lab/starterkit-twig-demo/dist/_annotations/", "styleguide": "dist/", "patternlabFiles": { "general-header": "views/partials/general-header.mustache", @@ -107,10 +107,10 @@ "patternSectionSubtype": "views/partials/patternSectionSubtype.mustache", "viewall": "views/viewall.mustache" }, - "js": "./source/js", - "images": "./source/images", - "fonts": "./source/fonts", - "css": "./source/css" + "js": "./node_modules/@pattern-lab/starterkit-twig-demo/dist/js", + "images": "./node_modules/@pattern-lab/starterkit-twig-demo/dist/images", + "fonts": "./node_modules/@pattern-lab/starterkit-twig-demo/dist/fonts", + "css": "./node_modules/@pattern-lab/starterkit-twig-demo/dist/css" }, "public": { "root": "public/", From 5426bc4c84dfdae65062954af1c7a9ca645f83b7 Mon Sep 17 00:00:00 2001 From: Salem Ghoweri Date: Sat, 21 Jul 2018 11:30:37 -0400 Subject: [PATCH 3/6] refactor: refactor PL node to support the ability to have uikit view templates not be inlined (aka allow Twig namespaced paths to point at these templates vs inlining the contents) --- packages/core/src/lib/buildFooter.js | 19 +++++--- packages/core/src/lib/buildPatterns.js | 25 ++++++++-- packages/core/src/lib/compose.js | 16 ++++++- packages/core/src/lib/loaduikits.js | 49 +++++++++++++------- packages/core/src/lib/ui_builder.js | 40 +++++++++++++--- packages/edition-twig/patternlab-config.json | 32 +++++++++++-- 6 files changed, 141 insertions(+), 40 deletions(-) diff --git a/packages/core/src/lib/buildFooter.js b/packages/core/src/lib/buildFooter.js index 5a3eb6217..8958363c5 100644 --- a/packages/core/src/lib/buildFooter.js +++ b/packages/core/src/lib/buildFooter.js @@ -15,12 +15,19 @@ let render = require('./render'); //eslint-disable-line prefer-const */ module.exports = function(patternlab, patternPartial, uikit) { //first render the general footer - return render(Pattern.createEmpty({ extendedTemplate: uikit.footer }), { - patternData: JSON.stringify({ - patternPartial: patternPartial, - }), - cacheBuster: patternlab.cacheBuster, - }) + return render( + Pattern.createEmpty( + uikit.footer.path + ? { relPath: uikit.footer.path } + : { extendedTemplate: uikit.footer } + ), + { + patternData: JSON.stringify({ + patternPartial: patternPartial, + }), + cacheBuster: patternlab.cacheBuster, + } + ) .then(footerPartial => { let allFooterData; try { diff --git a/packages/core/src/lib/buildPatterns.js b/packages/core/src/lib/buildPatterns.js index 51dcea8b3..22b930190 100644 --- a/packages/core/src/lib/buildPatterns.js +++ b/packages/core/src/lib/buildPatterns.js @@ -100,12 +100,29 @@ module.exports = (deletePatternDir, patternlab, additionalData) => { //cascade any patternStates lineage_hunter.cascade_pattern_states(patternlab); + let plHeader = Pattern.createEmpty({ + extendedTemplate: patternlab.header, + }); + + // because patternlab.header doesn't yet exist, we need to check the first uikit condfig specified to see if a template path is defined there, otherwise use the original default logic. + if ( + patternlab.header === undefined && + patternlab.uikits[Object.keys(patternlab.uikits)[0]] + .header !== undefined && + patternlab.uikits[Object.keys(patternlab.uikits)[0]].header + .path !== undefined + ) { + plHeader = Pattern.createEmpty({ + relPath: + patternlab.uikits[Object.keys(patternlab.uikits)[0]] + .header.path, + }); + } + //set the pattern-specific header by compiling the general-header with data, and then adding it to the meta header return render( - Pattern.createEmpty({ - // todo should this be uikit.header? - extendedTemplate: patternlab.header, - }), + // todo should this be uikit.header? + plHeader, { cacheBuster: patternlab.cacheBuster, } diff --git a/packages/core/src/lib/compose.js b/packages/core/src/lib/compose.js index 86b2f8f91..958c9c853 100644 --- a/packages/core/src/lib/compose.js +++ b/packages/core/src/lib/compose.js @@ -68,7 +68,13 @@ module.exports = function(pattern, patternlab) { headPromise = render(patternlab.userHead, allData); } else { headPromise = render( - Pattern.createEmpty({ extendedTemplate: uikit.header }), + Pattern.createEmpty( + uikit.header.path + ? { + relPath: uikit.header.path, + } + : { extendedTemplate: uikit.header } + ), allData ); } @@ -131,7 +137,13 @@ module.exports = function(pattern, patternlab) { //set the pattern-specific footer by compiling the general-footer with data, and then adding it to the meta footer const footerPartialPromise = render( - Pattern.createEmpty({ extendedTemplate: uikit.footer }), + Pattern.createEmpty( + uikit.footer.path + ? { + relPath: uikit.footer.path, + } + : { extendedTemplate: uikit.footer } + ), { isPattern: pattern.isPattern, patternData: pattern.patternData, diff --git a/packages/core/src/lib/loaduikits.js b/packages/core/src/lib/loaduikits.js index 1f97564a2..c7bb231e9 100644 --- a/packages/core/src/lib/loaduikits.js +++ b/packages/core/src/lib/loaduikits.js @@ -68,23 +68,38 @@ module.exports = patternlab => { outputDir: configEntry.outputDir, excludedPatternStates: configEntry.excludedPatternStates, excludedTags: configEntry.excludedTags, - header: readModuleFile( - kit, - paths.source.patternlabFiles['general-header'] - ), - footer: readModuleFile( - kit, - paths.source.patternlabFiles['general-footer'] - ), - patternSection: readModuleFile( - kit, - paths.source.patternlabFiles.patternSection - ), - patternSectionSubType: readModuleFile( - kit, - paths.source.patternlabFiles.patternSectionSubtype - ), - viewAll: readModuleFile(kit, paths.source.patternlabFiles.viewall), + + /** + * If the uikit asset config isn't a simple string path but an object, + * don't automatically inline the file's contents. This also keeps the + * door open for more advanced configurations down the road! + */ + header: typeof ( + paths.source.patternlabFiles['general-footer'] === 'object' + ) + ? paths.source.patternlabFiles['general-header'] + : readModuleFile(kit, paths.source.patternlabFiles['general-footer']), + footer: typeof ( + paths.source.patternlabFiles['general-footer'] === 'object' + ) + ? paths.source.patternlabFiles['general-footer'] + : readModuleFile(kit, paths.source.patternlabFiles['general-footer']), + patternSection: typeof ( + paths.source.patternlabFiles.patternSection === 'object' + ) + ? paths.source.patternlabFiles.patternSection + : readModuleFile(kit, paths.source.patternlabFiles.patternSection), + patternSectionSubType: typeof ( + paths.source.patternlabFiles.patternSectionSubType === 'object' + ) + ? paths.source.patternlabFiles.patternSectionSubType + : readModuleFile( + kit, + paths.source.patternlabFiles.patternSectionSubType + ), + viewAll: typeof (paths.source.patternlabFiles.viewall === 'object') + ? paths.source.patternlabFiles.viewall + : readModuleFile(kit, paths.source.patternlabFiles.viewall), }; // [3] } catch (ex) { logger.error(ex); diff --git a/packages/core/src/lib/ui_builder.js b/packages/core/src/lib/ui_builder.js index 96229e08c..6194dc7af 100644 --- a/packages/core/src/lib/ui_builder.js +++ b/packages/core/src/lib/ui_builder.js @@ -519,7 +519,13 @@ const ui_builder = function() { */ function buildViewAllHTML(patternlab, patterns, patternPartial, uikit) { return render( - Pattern.createEmpty({ extendedTemplate: uikit.viewAll }), + Pattern.createEmpty( + uikit.viewAll.path + ? { + relPath: uikit.viewAll.path, + } + : { extendedTemplate: uikit.viewAll } + ), { //data partials: patterns, @@ -764,7 +770,15 @@ const ui_builder = function() { return new Promise(resolve => { //set the pattern-specific header by compiling the general-header with data, and then adding it to the meta header const headerPromise = render( - Pattern.createEmpty({ extendedTemplate: uikit.header }), + Pattern.createEmpty( + uikit.header.path + ? { + relPath: uikit.header.path, + } + : { + extendedTemplate: uikit.header, + } + ), { cacheBuster: patternlab.cacheBuster, } @@ -782,7 +796,15 @@ const ui_builder = function() { //set the pattern-specific footer by compiling the general-footer with data, and then adding it to the meta footer const footerPromise = render( - Pattern.createEmpty({ extendedTemplate: uikit.footer }), + Pattern.createEmpty( + uikit.footer.path + ? { + relPath: uikit.footer.path, + } + : { + extendedTemplate: uikit.footer, + } + ), { patternData: '{}', cacheBuster: patternlab.cacheBuster, @@ -824,9 +846,15 @@ const ui_builder = function() { //build the main styleguide page return render( - Pattern.createEmpty({ - extendedTemplate: uikit.viewAll, - }), + Pattern.createEmpty( + uikit.viewAll.path + ? { + relPath: uikit.viewAll.path, + } + : { + extendedTemplate: uikit.viewAll, + } + ), { partials: uniquePatterns, }, diff --git a/packages/edition-twig/patternlab-config.json b/packages/edition-twig/patternlab-config.json index 90a028730..d303344c5 100644 --- a/packages/edition-twig/patternlab-config.json +++ b/packages/edition-twig/patternlab-config.json @@ -2,6 +2,13 @@ "engines": { "twig": { "namespaces": [ + { + "id": "uikit", + "recursive": true, + "paths": [ + "../uikit-workshop/views-twig/" + ] + }, { "id": "atoms", "recursive": true, @@ -101,11 +108,26 @@ "annotations": "./node_modules/@pattern-lab/starterkit-twig-demo/dist/_annotations/", "styleguide": "dist/", "patternlabFiles": { - "general-header": "views/partials/general-header.mustache", - "general-footer": "views/partials/general-footer.mustache", - "patternSection": "views/partials/patternSection.mustache", - "patternSectionSubtype": "views/partials/patternSectionSubtype.mustache", - "viewall": "views/viewall.mustache" + "general-header": { + "inline": false, + "path": "@uikit/general-header.twig" + }, + "general-footer": { + "inline": false, + "path": "@uikit/general-footer.twig" + }, + "patternSection": { + "inline": false, + "path": "@uikit/patternSection.twig" + }, + "patternSectionSubtype": { + "inline": false, + "path": "@uikit/patternSectionSubtype.twig" + }, + "viewall": { + "inline": false, + "path": "@uikit/viewall.twig" + } }, "js": "./node_modules/@pattern-lab/starterkit-twig-demo/dist/js", "images": "./node_modules/@pattern-lab/starterkit-twig-demo/dist/images", From 3d0a0ac8a15db9b4d2da60a22547c1e7977035db Mon Sep 17 00:00:00 2001 From: Salem Ghoweri Date: Sat, 21 Jul 2018 11:55:42 -0400 Subject: [PATCH 4/6] chore: remove unused config option --- packages/edition-twig/patternlab-config.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/edition-twig/patternlab-config.json b/packages/edition-twig/patternlab-config.json index d303344c5..a4d00d3b2 100644 --- a/packages/edition-twig/patternlab-config.json +++ b/packages/edition-twig/patternlab-config.json @@ -109,23 +109,18 @@ "styleguide": "dist/", "patternlabFiles": { "general-header": { - "inline": false, "path": "@uikit/general-header.twig" }, "general-footer": { - "inline": false, "path": "@uikit/general-footer.twig" }, "patternSection": { - "inline": false, "path": "@uikit/patternSection.twig" }, "patternSectionSubtype": { - "inline": false, "path": "@uikit/patternSectionSubtype.twig" }, "viewall": { - "inline": false, "path": "@uikit/viewall.twig" } }, From 0c965cc7f7fca2d5100f2e92438f5799bb934fe7 Mon Sep 17 00:00:00 2001 From: Salem Ghoweri Date: Sat, 21 Jul 2018 20:18:57 -0400 Subject: [PATCH 5/6] fix: clean up Pattern.createEmpty conditionals to improve readability; fix typo / formatting bug causing mustache loader to not compile base UI templates as expected --- packages/core/src/lib/buildFooter.js | 8 ++-- packages/core/src/lib/compose.js | 20 +++------- packages/core/src/lib/loaduikits.js | 55 +++++++++++++++------------- packages/core/src/lib/ui_builder.js | 50 ++++++++----------------- 4 files changed, 54 insertions(+), 79 deletions(-) diff --git a/packages/core/src/lib/buildFooter.js b/packages/core/src/lib/buildFooter.js index 8958363c5..ec839d470 100644 --- a/packages/core/src/lib/buildFooter.js +++ b/packages/core/src/lib/buildFooter.js @@ -16,11 +16,9 @@ let render = require('./render'); //eslint-disable-line prefer-const module.exports = function(patternlab, patternPartial, uikit) { //first render the general footer return render( - Pattern.createEmpty( - uikit.footer.path - ? { relPath: uikit.footer.path } - : { extendedTemplate: uikit.footer } - ), + uikit.footer.path + ? Pattern.createEmpty({ relPath: uikit.footer.path }) + : Pattern.createEmpty({ extendedTemplate: uikit.footer }), { patternData: JSON.stringify({ patternPartial: patternPartial, diff --git a/packages/core/src/lib/compose.js b/packages/core/src/lib/compose.js index 958c9c853..880977286 100644 --- a/packages/core/src/lib/compose.js +++ b/packages/core/src/lib/compose.js @@ -68,13 +68,9 @@ module.exports = function(pattern, patternlab) { headPromise = render(patternlab.userHead, allData); } else { headPromise = render( - Pattern.createEmpty( - uikit.header.path - ? { - relPath: uikit.header.path, - } - : { extendedTemplate: uikit.header } - ), + uikit.header.path + ? Pattern.createEmpty({ relPath: uikit.header.path }) + : Pattern.createEmpty({ extendedTemplate: uikit.header }), allData ); } @@ -137,13 +133,9 @@ module.exports = function(pattern, patternlab) { //set the pattern-specific footer by compiling the general-footer with data, and then adding it to the meta footer const footerPartialPromise = render( - Pattern.createEmpty( - uikit.footer.path - ? { - relPath: uikit.footer.path, - } - : { extendedTemplate: uikit.footer } - ), + uikit.footer.path + ? Pattern.createEmpty({ relPath: uikit.footer.path }) + : Pattern.createEmpty({ extendedTemplate: uikit.footer }), { isPattern: pattern.isPattern, patternData: pattern.patternData, diff --git a/packages/core/src/lib/loaduikits.js b/packages/core/src/lib/loaduikits.js index c7bb231e9..d2025237e 100644 --- a/packages/core/src/lib/loaduikits.js +++ b/packages/core/src/lib/loaduikits.js @@ -74,32 +74,35 @@ module.exports = patternlab => { * don't automatically inline the file's contents. This also keeps the * door open for more advanced configurations down the road! */ - header: typeof ( - paths.source.patternlabFiles['general-footer'] === 'object' - ) - ? paths.source.patternlabFiles['general-header'] - : readModuleFile(kit, paths.source.patternlabFiles['general-footer']), - footer: typeof ( - paths.source.patternlabFiles['general-footer'] === 'object' - ) - ? paths.source.patternlabFiles['general-footer'] - : readModuleFile(kit, paths.source.patternlabFiles['general-footer']), - patternSection: typeof ( - paths.source.patternlabFiles.patternSection === 'object' - ) - ? paths.source.patternlabFiles.patternSection - : readModuleFile(kit, paths.source.patternlabFiles.patternSection), - patternSectionSubType: typeof ( - paths.source.patternlabFiles.patternSectionSubType === 'object' - ) - ? paths.source.patternlabFiles.patternSectionSubType - : readModuleFile( - kit, - paths.source.patternlabFiles.patternSectionSubType - ), - viewAll: typeof (paths.source.patternlabFiles.viewall === 'object') - ? paths.source.patternlabFiles.viewall - : readModuleFile(kit, paths.source.patternlabFiles.viewall), + header: + typeof paths.source.patternlabFiles['general-header'] === 'object' + ? paths.source.patternlabFiles['general-header'] + : readModuleFile( + kit, + paths.source.patternlabFiles['general-header'] + ), + footer: + typeof paths.source.patternlabFiles['general-footer'] === 'object' + ? paths.source.patternlabFiles['general-footer'] + : readModuleFile( + kit, + paths.source.patternlabFiles['general-footer'] + ), + patternSection: + typeof paths.source.patternlabFiles.patternSection === 'object' + ? paths.source.patternlabFiles.patternSection + : readModuleFile(kit, paths.source.patternlabFiles.patternSection), + patternSectionSubType: + typeof paths.source.patternlabFiles.patternSectionSubtype === 'object' + ? paths.source.patternlabFiles.patternSectionSubtype + : readModuleFile( + kit, + paths.source.patternlabFiles.patternSectionSubtype + ), + viewAll: + typeof paths.source.patternlabFiles.viewall === 'object' + ? paths.source.patternlabFiles.viewall + : readModuleFile(kit, paths.source.patternlabFiles.viewall), }; // [3] } catch (ex) { logger.error(ex); diff --git a/packages/core/src/lib/ui_builder.js b/packages/core/src/lib/ui_builder.js index 6194dc7af..7802f81cd 100644 --- a/packages/core/src/lib/ui_builder.js +++ b/packages/core/src/lib/ui_builder.js @@ -519,13 +519,9 @@ const ui_builder = function() { */ function buildViewAllHTML(patternlab, patterns, patternPartial, uikit) { return render( - Pattern.createEmpty( - uikit.viewAll.path - ? { - relPath: uikit.viewAll.path, - } - : { extendedTemplate: uikit.viewAll } - ), + uikit.viewAll.path + ? Pattern.createEmpty({ relPath: uikit.viewAll.path }) + : Pattern.createEmpty({ extendedTemplate: uikit.viewAll }), { //data partials: patterns, @@ -770,15 +766,9 @@ const ui_builder = function() { return new Promise(resolve => { //set the pattern-specific header by compiling the general-header with data, and then adding it to the meta header const headerPromise = render( - Pattern.createEmpty( - uikit.header.path - ? { - relPath: uikit.header.path, - } - : { - extendedTemplate: uikit.header, - } - ), + uikit.header.path + ? Pattern.createEmpty({ relPath: uikit.header.path }) + : Pattern.createEmpty({ extendedTemplate: uikit.header }), { cacheBuster: patternlab.cacheBuster, } @@ -796,15 +786,9 @@ const ui_builder = function() { //set the pattern-specific footer by compiling the general-footer with data, and then adding it to the meta footer const footerPromise = render( - Pattern.createEmpty( - uikit.footer.path - ? { - relPath: uikit.footer.path, - } - : { - extendedTemplate: uikit.footer, - } - ), + uikit.footer.path + ? Pattern.createEmpty({ relPath: uikit.footer.path }) + : Pattern.createEmpty({ extendedTemplate: uikit.footer }), { patternData: '{}', cacheBuster: patternlab.cacheBuster, @@ -846,15 +830,13 @@ const ui_builder = function() { //build the main styleguide page return render( - Pattern.createEmpty( - uikit.viewAll.path - ? { - relPath: uikit.viewAll.path, - } - : { - extendedTemplate: uikit.viewAll, - } - ), + uikit.viewAll.path + ? Pattern.createEmpty({ + relPath: uikit.viewAll.path, + }) + : Pattern.createEmpty({ + extendedTemplate: uikit.viewAll, + }), { partials: uniquePatterns, }, From eda01dc553a60e26f61ed42ffe66268bb73d7f0f Mon Sep 17 00:00:00 2001 From: Salem Ghoweri Date: Sun, 22 Jul 2018 09:07:39 -0400 Subject: [PATCH 6/6] fix: partial Twig-specific fix for the collapsible code panels being broken on master, most likely due to internal data structure changes implemented at some point. Updates fix the issue reported in #761 however are unfortunately Twig specific for now until the underlying changes are identified and internally exported data structures are updated accordingly. --- .../views-twig/partials/patternSection.twig | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/uikit-workshop/views-twig/partials/patternSection.twig b/packages/uikit-workshop/views-twig/partials/patternSection.twig index e085c40c4..7868faf8a 100755 --- a/packages/uikit-workshop/views-twig/partials/patternSection.twig +++ b/packages/uikit-workshop/views-twig/partials/patternSection.twig @@ -1,5 +1,5 @@
- +

@@ -9,7 +9,7 @@ {% endif %}

- +
{{ partial.patternBreadcrumb }} @@ -28,7 +28,24 @@