Skip to content
This repository was archived by the owner on Dec 10, 2019. It is now read-only.

Commit 6b22356

Browse files
committed
Merge remote-tracking branch 'upstream/master' into pattern-engines
2 parents 5c745c2 + 3f2efa9 commit 6b22356

26 files changed

+396
-155
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ public/index.html
44
public/styleguide.html
55
public/styleguide/html/styleguide.html
66
public/css/*
7+
public/data/*
78
public/fonts/*
89
public/js/*
910
public/images/*

CHANGELOG

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
THIS CHANGELOG IS AN ATTEMPT TO DOCUMENT CHANGES TO THIS PROJECT.
22

3+
PL-node-v1.0.0
4+
- FIX: Resolve issue with not hiding underscored patterns.
5+
- THX: Thanks @ivancamilov for reporting this regression.
6+
- FIX: Fix misapplied error input class
7+
- THX: Thanks @johngerome for the pull request!
8+
- ADD: Added a note in the README during installation to run with elevated privileges
9+
- THX: Thanks @RichardBray for the heads up
10+
- ADD: Added a Prerequisites section to the README
11+
- ADD: Added unit tests for pattern states and pseudopatterns
12+
- CHG: Changed pseudopattern generation to use config.patterns.source directory instead of hardcode
13+
- CHG: Explicitly sorting patterns by name prior to building the UI
14+
- ADD: Added ability to specify link.* urls inside data objects
15+
- CHG: Incremented version to 1.0.0. Achieved near-parity with PL PHP 1!
16+
- THX: Thanks to each and every person who cared about Pattern Lab Node! - Brian
17+
318
PL-node-v0.15.1
419
- FIX: Resolve issue with styleModifiers not being replaced when the partial has spaces in it.
520
- ADD: Support multiple styleModifier classes using the | pipe syntax

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,20 @@ 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+
### Prerequisites
10+
11+
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)
12+
913
### Download
1014

1115
* Download the [latest release of patternlab-node](https://github.com/pattern-lab/patternlab-node/releases/latest) from Github
1216
* Via npm, run `npm install patternlab-node` (Note this will auto install the grunt version currently. see below)
1317
* **NOTE** Node version 4.X and 5.X have tentative support, citing [a lot of Windows issues](https://github.com/nodejs/node-gyp/issues/629), including [mine](https://github.com/pattern-lab/patternlab-node/issues/162). Upgrade node at your own risk until otherwise stated. I've tried to catalog some issues and troubleshooting steps on the [wiki](https://github.com/pattern-lab/patternlab-node/wiki/Windows-Issues).
1418

19+
### Troubleshooting Installs
20+
21+
Make sure you are running your terminal/command line session as administrator. This could mean `sudo`, or opening the window with a right-click option.
22+
1523
### Choose Your Adventure! Now Vanilla, Grunt & Gulp
1624

1725
This repository ships with two `package.json` files, a `Gruntfile.js`, and a `gulpfile.js`. The default is grunt currently. The core builder is not dependent on either.

builder/lineage_hunter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.15.1 - 2015
2+
* patternlab-node - v1.0.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/list_item_hunter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.15.1 - 2015
2+
* patternlab-node - v1.0.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/media_hunter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.15.1 - 2015
2+
* patternlab-node - v1.0.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/object_factory.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/*
2-
* patternlab-node - v0.15.1 - 2015
3-
*
1+
/*
2+
* patternlab-node - v1.0.0 - 2015
3+
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.
66
*

builder/parameter_hunter.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/*
2-
* patternlab-node - v0.15.1 - 2015
3-
*
1+
/*
2+
* patternlab-node - v1.0.0 - 2015
3+
*
44
* Brian Muenzenmeyer, and the web community.
5-
* Licensed under the MIT license.
6-
*
7-
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
5+
* Licensed under the MIT license.
6+
*
7+
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
88
*
99
*/
1010

builder/pattern_assembler.js

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.15.1 - 2015
2+
* patternlab-node - v1.0.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.
@@ -21,14 +21,15 @@
2121
var config = fs.readJSONSync('./config.json');
2222

2323
function setState(pattern, patternlab){
24-
if(patternlab.config.patternStates[pattern.patternName]){
24+
if(patternlab.config.patternStates && patternlab.config.patternStates[pattern.patternName]){
2525
pattern.patternState = patternlab.config.patternStates[pattern.patternName];
2626
} else{
2727
pattern.patternState = "";
2828
}
2929
}
3030

3131
function addPattern(pattern, patternlab){
32+
//add the link to the global object
3233
patternlab.data.link[pattern.patternGroup + '-' + pattern.patternName] = '/patterns/' + pattern.patternLink;
3334

3435
//only push to array if the array doesn't contain this pattern
@@ -87,19 +88,11 @@
8788

8889
//if file is named in the syntax for variants
8990
if(patternEngines.isPseudoPatternJSON(filename)){
90-
//add current pattern to patternlab object with minimal data
91-
//processPatternRecursive() will run find_pseudopatterns() to fill out
92-
//the object in the next diveSync
93-
addPattern(currentPattern, patternlab);
94-
//no need to process further
9591
return currentPattern;
9692
}
9793

9894
//can ignore all non-supported files at this point
9995
if(patternEngines.isFileExtensionSupported(ext) === false){
100-
if (config.debug) {
101-
console.log('==================== FOUND NON-MUSTACHE FILE');
102-
}
10396
return currentPattern;
10497
}
10598

@@ -276,6 +269,36 @@
276269

277270

278271

272+
//look for pattern links included in data files.
273+
//these will be in the form of link.* WITHOUT {{}}, which would still be there from direct pattern inclusion
274+
function parseDataLinks(patternlab){
275+
276+
//loop through all patterns
277+
for (var i = 0; i < patternlab.patterns.length; i++){
278+
var pattern = patternlab.patterns[i];
279+
//look for link.* such as link.pages-blog as a value
280+
var linkRE = /link.[A-z0-9-_]+/g;
281+
//convert to string for easier searching
282+
var dataObjAsString = JSON.stringify(pattern.jsonFileData);
283+
var linkMatches = dataObjAsString.match(linkRE);
284+
285+
//if no matches found, escape current loop iteration
286+
if(linkMatches === null) { continue; }
287+
288+
for(var i = 0; i < linkMatches.length; i++){
289+
//for each match, find the expanded link within the already constructed patternlab.data.link object
290+
var expandedLink = patternlab.data.link[linkMatches[i].split('.')[1]];
291+
if(patternlab.config.debug){
292+
console.log('expanded data link from ' + linkMatches[i] + ' to ' + expandedLink + ' inside ' + pattern.key);
293+
}
294+
//replace value with expandedLink on the pattern
295+
dataObjAsString = dataObjAsString.replace(linkMatches[i], expandedLink);
296+
}
297+
//write back to data on the pattern
298+
pattern.jsonFileData = JSON.parse(dataObjAsString);
299+
}
300+
}
301+
279302
return {
280303
find_pattern_partials: function(pattern){
281304
return pattern.findPartials();
@@ -309,6 +332,9 @@
309332
},
310333
combine_listItems: function(patternlab){
311334
buildListItems(patternlab);
335+
},
336+
parse_data_links: function(patternlab){
337+
parseDataLinks(patternlab);
312338
}
313339
};
314340

builder/pattern_exporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.15.1 - 2015
2+
* patternlab-node - v1.0.0 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

0 commit comments

Comments
 (0)