Skip to content

Pattern Lab Node v1.1.3 #267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Feb 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
THIS CHANGELOG IS AN ATTEMPT TO DOCUMENT CHANGES TO THIS PROJECT.

PL-node-v1.1.3
- FIX: Added pattern type view all pages to the navigation, which users view all 'Atoms/Molecules/Organisms' etc.
- THX: Thanks to @gael-boyenval for originally pointing out the omission.

PL-node-v1.1.2
- 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.
- THX: Thanks to @geoffp for taking the lead on this issue.
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ The Node version of [Pattern Lab](http://patternlab.io/) is, at its core, a stat

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.

###### Core Team

* [@bmuenzenmeyer](https://github.com/bmuenzenmeyer) - Lead Maintainer
* [@geoffp](https://github.com/geoffp) - Core Contributor

### Prerequisites

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)
Expand Down
2 changes: 1 addition & 1 deletion builder/lineage_hunter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.2 - 2016
* patternlab-node - v1.1.3 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
2 changes: 1 addition & 1 deletion builder/list_item_hunter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.2 - 2016
* patternlab-node - v1.1.3 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
2 changes: 1 addition & 1 deletion builder/media_hunter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.2 - 2016
* patternlab-node - v1.1.3 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
2 changes: 1 addition & 1 deletion builder/object_factory.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.2 - 2016
* patternlab-node - v1.1.3 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
8 changes: 4 additions & 4 deletions builder/parameter_hunter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.2 - 2016
* patternlab-node - v1.1.3 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down Expand Up @@ -40,11 +40,11 @@
var rightParen = pMatch.indexOf(')');
var paramString = '{' + pMatch.substring(leftParen + 1, rightParen) + '}';
//if param keys are wrapped in single quotes, replace with double quotes.
var paramStringWellFormed = paramString.replace(/(')([^']+)(')(\s*\:)/gm, '"$2"$4');
var paramStringWellFormed = paramString.replace(/(')([^']+)(')(\s*\:)/g, '"$2"$4');
//if params keys are not wrapped in any quotes, wrap in double quotes.
var paramStringWellFormed = paramStringWellFormed.replace(/([\{|,]\s*)([^\:\s]+)(\s*\:)/gm, '$1"$2"$3');
var paramStringWellFormed = paramStringWellFormed.replace(/([\{|,]\s*)([^\s"'\:]+)(\s*\:)/g, '$1"$2"$3');
//if param values are wrapped in single quotes, replace with double quotes.
var paramStringWellFormed = paramStringWellFormed.replace(/(\:\s*)(')([^']+)(')/gm, '$1"$3"');
var paramStringWellFormed = paramStringWellFormed.replace(/(\:\s*)(')([^']+)(')/g, '$1"$3"');

var paramData = {};
var globalData = {};
Expand Down
2 changes: 1 addition & 1 deletion builder/pattern_assembler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.2 - 2016
* patternlab-node - v1.1.3 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
2 changes: 1 addition & 1 deletion builder/pattern_exporter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.2 - 2016
* patternlab-node - v1.1.3 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
55 changes: 47 additions & 8 deletions builder/patternlab.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.2 - 2016
* patternlab-node - v1.1.3 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down Expand Up @@ -207,7 +207,8 @@ var patternlab_engine = function (config) {

//build the viewall pages
var prevSubdir = '',
i;
prevGroup = '',
i;

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

var pattern = patternlab.patterns[i];

//create the view all for the section
// check if the current section is different from the previous one
if (pattern.patternGroup != prevGroup){
prevGroup = pattern.patternGroup;

var viewAllPatterns = [],
patternPartial = "viewall-" + pattern.patternGroup,
j;

for (j = 0; j < patternlab.patterns.length; j++) {
if (patternlab.patterns[j].patternGroup === pattern.patternGroup) {
//again, skip any sibling patterns to the current one that may have underscores
if(isPatternExcluded(patternlab.patterns[j])){
if(patternlab.config.debug){
console.log('Omitting ' + patternlab.patterns[j].key + " from view all sibling rendering.");
}
continue;
}

viewAllPatterns.push(patternlab.patterns[j]);
}
}

var viewAllTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'viewall.mustache'), 'utf8');
var viewAllHtml = pattern_assembler.renderPattern(viewAllTemplate, {partials: viewAllPatterns, patternPartial: patternPartial});
fs.outputFileSync(paths.public.patterns + pattern.subdir.slice(0, pattern.subdir.indexOf(pattern.patternGroup) + pattern.patternGroup.length) + '/index.html', viewAllHtml);
}

//create the view all for the subsection
// check if the current sub section is different from the previous one
if (pattern.subdir !== prevSubdir) {
prevSubdir = pattern.subdir;
Expand Down Expand Up @@ -318,6 +348,14 @@ var patternlab_engine = function (config) {
//add to patternPaths
addToPatternPaths(bucketName, pattern);

//add the navViewAllItem
var navViewAllItem = new of.oNavSubItem("View All");
navViewAllItem.patternPath = pattern.subdir.slice(0, pattern.subdir.indexOf(pattern.patternGroup) + pattern.patternGroup.length) + "/index.html";
navViewAllItem.patternPartial = "viewall-" + pattern.patternGroup;

bucket.patternItems.push(navViewAllItem);
patternlab.viewAllPaths[bucketName]['viewall'] = pattern.subdir.slice(0, pattern.subdir.indexOf(pattern.patternGroup) + pattern.patternGroup.length);

}

//add the bucket.
Expand Down Expand Up @@ -393,14 +431,15 @@ var patternlab_engine = function (config) {
}
}

//add the navViewAllSubItem
var navViewAllSubItem = new of.oNavSubItem("");
navViewAllSubItem.patternName = "View All";
navViewAllSubItem.patternPath = pattern.flatPatternPath + "/index.html";
navViewAllSubItem.patternPartial = "viewall-" + pattern.patternGroup + "-" + pattern.patternSubGroup;

//check if we are moving to a new sub section in the next loop
if (!patternlab.patterns[i + 1] || pattern.patternSubGroup !== patternlab.patterns[i + 1].patternSubGroup) {

//add the navViewAllSubItem
var navViewAllSubItem = new of.oNavSubItem("");
navViewAllSubItem.patternName = "View All";
navViewAllSubItem.patternPath = pattern.flatPatternPath + "/index.html";
navViewAllSubItem.patternPartial = "viewall-" + pattern.patternGroup + "-" + pattern.patternSubGroup;

navItem.navSubItems.push(navViewAllSubItem);
navItem.navSubItemsIndex.push("View All");
}
Expand Down
2 changes: 1 addition & 1 deletion builder/patternlab_grunt.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.2 - 2016
* patternlab-node - v1.1.3 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
2 changes: 1 addition & 1 deletion builder/patternlab_gulp.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.2 - 2016
* patternlab-node - v1.1.3 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
2 changes: 1 addition & 1 deletion builder/pseudopattern_hunter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.2 - 2016
* patternlab-node - v1.1.3 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
2 changes: 1 addition & 1 deletion builder/style_modifier_hunter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.2 - 2016
* patternlab-node - v1.1.3 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ gulp.task('cp:img', function(){
// Fonts copy
gulp.task('cp:font', function(){
return gulp.src('*', {cwd: path.resolve(paths().source.fonts)})
.pipe(gulp.dest(path.resolve(paths().public.images)));
.pipe(gulp.dest(path.resolve(paths().public.fonts)));
});

// Data copy
Expand Down
2 changes: 1 addition & 1 deletion package.gulp.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "patternlab-node",
"description": "Pattern Lab is a collection of tools to help you create atomic design systems. This is the node command line interface (CLI).",
"version": "1.1.2",
"version": "1.1.3",
"main": "./builder/patternlab.js",
"dependencies": {
"del": "^2.2.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "patternlab-node",
"description": "Pattern Lab is a collection of tools to help you create atomic design systems. This is the node command line interface (CLI).",
"version": "1.1.2",
"version": "1.1.3",
"main": "./builder/patternlab.js",
"dependencies": {
"diveSync": "^0.3.0",
Expand Down
Loading