Skip to content

Commit 1fc4eaf

Browse files
author
Brian Muenzenmeyer
committed
Merge pull request #267 from pattern-lab/dev
Pattern Lab Node v1.1.3
2 parents 5eb168e + d7535dc commit 1fc4eaf

18 files changed

+277
-214
lines changed

CHANGELOG

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
THIS CHANGELOG IS AN ATTEMPT TO DOCUMENT CHANGES TO THIS PROJECT.
22

3+
PL-node-v1.1.3
4+
- FIX: Added pattern type view all pages to the navigation, which users view all 'Atoms/Molecules/Organisms' etc.
5+
- THX: Thanks to @gael-boyenval for originally pointing out the omission.
6+
37
PL-node-v1.1.2
48
- FIX: Greatly improved the browsersync configuration, so that it only fires on the iframe, preventing users from losing their scroll position. Also lightened up the styling and made it less obtrusive.
59
- THX: Thanks to @geoffp for taking the lead on this issue.

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The Node version of [Pattern Lab](http://patternlab.io/) is, at its core, a stat
66

77
This repository contains the vanilla builder logic, grunt and gulp configurations, and some sample template/css/data to illustrate the power and flexibility of the tool.
88

9+
###### Core Team
10+
11+
* [@bmuenzenmeyer](https://github.com/bmuenzenmeyer) - Lead Maintainer
12+
* [@geoffp](https://github.com/geoffp) - Core Contributor
13+
914
### Prerequisites
1015

1116
Make sure Node and npm are installed. A great guide can be found here: [https://docs.npmjs.com/getting-started/installing-node](https://docs.npmjs.com/getting-started/installing-node)

builder/lineage_hunter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v1.1.2 - 2016
2+
* patternlab-node - v1.1.3 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/list_item_hunter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v1.1.2 - 2016
2+
* patternlab-node - v1.1.3 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/media_hunter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v1.1.2 - 2016
2+
* patternlab-node - v1.1.3 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/object_factory.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v1.1.2 - 2016
2+
* patternlab-node - v1.1.3 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/parameter_hunter.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v1.1.2 - 2016
2+
* patternlab-node - v1.1.3 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.
@@ -40,11 +40,11 @@
4040
var rightParen = pMatch.indexOf(')');
4141
var paramString = '{' + pMatch.substring(leftParen + 1, rightParen) + '}';
4242
//if param keys are wrapped in single quotes, replace with double quotes.
43-
var paramStringWellFormed = paramString.replace(/(')([^']+)(')(\s*\:)/gm, '"$2"$4');
43+
var paramStringWellFormed = paramString.replace(/(')([^']+)(')(\s*\:)/g, '"$2"$4');
4444
//if params keys are not wrapped in any quotes, wrap in double quotes.
45-
var paramStringWellFormed = paramStringWellFormed.replace(/([\{|,]\s*)([^\:\s]+)(\s*\:)/gm, '$1"$2"$3');
45+
var paramStringWellFormed = paramStringWellFormed.replace(/([\{|,]\s*)([^\s"'\:]+)(\s*\:)/g, '$1"$2"$3');
4646
//if param values are wrapped in single quotes, replace with double quotes.
47-
var paramStringWellFormed = paramStringWellFormed.replace(/(\:\s*)(')([^']+)(')/gm, '$1"$3"');
47+
var paramStringWellFormed = paramStringWellFormed.replace(/(\:\s*)(')([^']+)(')/g, '$1"$3"');
4848

4949
var paramData = {};
5050
var globalData = {};

builder/pattern_assembler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v1.1.2 - 2016
2+
* patternlab-node - v1.1.3 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/pattern_exporter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v1.1.2 - 2016
2+
* patternlab-node - v1.1.3 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/patternlab.js

+47-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v1.1.2 - 2016
2+
* patternlab-node - v1.1.3 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.
@@ -207,7 +207,8 @@ var patternlab_engine = function (config) {
207207

208208
//build the viewall pages
209209
var prevSubdir = '',
210-
i;
210+
prevGroup = '',
211+
i;
211212

212213
for (i = 0; i < patternlab.patterns.length; i++) {
213214
// skip underscore-prefixed files
@@ -220,6 +221,35 @@ var patternlab_engine = function (config) {
220221

221222
var pattern = patternlab.patterns[i];
222223

224+
//create the view all for the section
225+
// check if the current section is different from the previous one
226+
if (pattern.patternGroup != prevGroup){
227+
prevGroup = pattern.patternGroup;
228+
229+
var viewAllPatterns = [],
230+
patternPartial = "viewall-" + pattern.patternGroup,
231+
j;
232+
233+
for (j = 0; j < patternlab.patterns.length; j++) {
234+
if (patternlab.patterns[j].patternGroup === pattern.patternGroup) {
235+
//again, skip any sibling patterns to the current one that may have underscores
236+
if(isPatternExcluded(patternlab.patterns[j])){
237+
if(patternlab.config.debug){
238+
console.log('Omitting ' + patternlab.patterns[j].key + " from view all sibling rendering.");
239+
}
240+
continue;
241+
}
242+
243+
viewAllPatterns.push(patternlab.patterns[j]);
244+
}
245+
}
246+
247+
var viewAllTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'viewall.mustache'), 'utf8');
248+
var viewAllHtml = pattern_assembler.renderPattern(viewAllTemplate, {partials: viewAllPatterns, patternPartial: patternPartial});
249+
fs.outputFileSync(paths.public.patterns + pattern.subdir.slice(0, pattern.subdir.indexOf(pattern.patternGroup) + pattern.patternGroup.length) + '/index.html', viewAllHtml);
250+
}
251+
252+
//create the view all for the subsection
223253
// check if the current sub section is different from the previous one
224254
if (pattern.subdir !== prevSubdir) {
225255
prevSubdir = pattern.subdir;
@@ -318,6 +348,14 @@ var patternlab_engine = function (config) {
318348
//add to patternPaths
319349
addToPatternPaths(bucketName, pattern);
320350

351+
//add the navViewAllItem
352+
var navViewAllItem = new of.oNavSubItem("View All");
353+
navViewAllItem.patternPath = pattern.subdir.slice(0, pattern.subdir.indexOf(pattern.patternGroup) + pattern.patternGroup.length) + "/index.html";
354+
navViewAllItem.patternPartial = "viewall-" + pattern.patternGroup;
355+
356+
bucket.patternItems.push(navViewAllItem);
357+
patternlab.viewAllPaths[bucketName]['viewall'] = pattern.subdir.slice(0, pattern.subdir.indexOf(pattern.patternGroup) + pattern.patternGroup.length);
358+
321359
}
322360

323361
//add the bucket.
@@ -393,14 +431,15 @@ var patternlab_engine = function (config) {
393431
}
394432
}
395433

396-
//add the navViewAllSubItem
397-
var navViewAllSubItem = new of.oNavSubItem("");
398-
navViewAllSubItem.patternName = "View All";
399-
navViewAllSubItem.patternPath = pattern.flatPatternPath + "/index.html";
400-
navViewAllSubItem.patternPartial = "viewall-" + pattern.patternGroup + "-" + pattern.patternSubGroup;
401-
402434
//check if we are moving to a new sub section in the next loop
403435
if (!patternlab.patterns[i + 1] || pattern.patternSubGroup !== patternlab.patterns[i + 1].patternSubGroup) {
436+
437+
//add the navViewAllSubItem
438+
var navViewAllSubItem = new of.oNavSubItem("");
439+
navViewAllSubItem.patternName = "View All";
440+
navViewAllSubItem.patternPath = pattern.flatPatternPath + "/index.html";
441+
navViewAllSubItem.patternPartial = "viewall-" + pattern.patternGroup + "-" + pattern.patternSubGroup;
442+
404443
navItem.navSubItems.push(navViewAllSubItem);
405444
navItem.navSubItemsIndex.push("View All");
406445
}

builder/patternlab_grunt.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v1.1.2 - 2016
2+
* patternlab-node - v1.1.3 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/patternlab_gulp.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v1.1.2 - 2016
2+
* patternlab-node - v1.1.3 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/pseudopattern_hunter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v1.1.2 - 2016
2+
* patternlab-node - v1.1.3 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/style_modifier_hunter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v1.1.2 - 2016
2+
* patternlab-node - v1.1.3 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

gulpfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ gulp.task('cp:img', function(){
7777
// Fonts copy
7878
gulp.task('cp:font', function(){
7979
return gulp.src('*', {cwd: path.resolve(paths().source.fonts)})
80-
.pipe(gulp.dest(path.resolve(paths().public.images)));
80+
.pipe(gulp.dest(path.resolve(paths().public.fonts)));
8181
});
8282

8383
// Data copy

package.gulp.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "patternlab-node",
33
"description": "Pattern Lab is a collection of tools to help you create atomic design systems. This is the node command line interface (CLI).",
4-
"version": "1.1.2",
4+
"version": "1.1.3",
55
"main": "./builder/patternlab.js",
66
"dependencies": {
77
"del": "^2.2.0",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "patternlab-node",
33
"description": "Pattern Lab is a collection of tools to help you create atomic design systems. This is the node command line interface (CLI).",
4-
"version": "1.1.2",
4+
"version": "1.1.3",
55
"main": "./builder/patternlab.js",
66
"dependencies": {
77
"diveSync": "^0.3.0",

0 commit comments

Comments
 (0)