Skip to content

Commit bdd5973

Browse files
author
Brian Muenzenmeyer
committed
Merge pull request pattern-lab#137 from pattern-lab/dev
v0.10.1
2 parents f5219c9 + 1d0fd0b commit bdd5973

18 files changed

+438
-57
lines changed

CHANGELOG

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
THIS CHANGELOG IS AN ATTEMPT TO DOCUMENT CHANGES TO THIS PROJECT.
2+
PL-node-v0.10.1
3+
- ADD: Added more unit tests for recently more-modular code
4+
- FIX: Lineage was not working for patterns with pattern parameters
5+
26
PL-node-v0.10.0
37
- ADD: Added support for pattern parameters! Resolves #88
48
- FIX: Data inheritance is now working as advertised. Resolves #127. This turned out to be a MAJOR thing, as I realized the home-page was not passing down any of its json data to partials.
@@ -7,7 +11,8 @@ PL-node-v0.10.0
711
- ADD: Added a new comment organism, the sticky comment, to ship an example of pattern parameters
812
- CHG: Start some JS linting of the project. I don't quite agree with a lot of it, so am trying to set some smart configurations
913
- CHG: Wrapped some build messages in the patternlab.config.debug flag
10-
- FIX: Allow users to set a base url path. Resolves #125 ([)testing in the while requested)
14+
- FIX: Allow users to set a base url path. Resolves #125 (testing in the wild requested)
15+
- THX: Thanks @scottnath for the proposed base url solution and @jkbyln for discussion on the topic too!
1116

1217
PL-node-v0.9.1
1318
- FIX: Fixed an issue with view all navigation not checking for index out of bounds cases

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ module.exports = function(grunt) {
133133
grunt.registerTask('default', ['clean', 'concat', 'patternlab', /*'sass',*/ 'copy']);
134134

135135
//travis CI task
136-
grunt.registerTask('travis', ['clean', 'concat', 'patternlab', /*'sass',*/ 'copy', 'nodeunit']);
136+
grunt.registerTask('travis', ['nodeunit', 'clean', 'concat', 'patternlab', /*'sass',*/ 'copy']);
137137

138138
grunt.registerTask('serve', ['clean', 'concat', 'patternlab', /*'sass',*/ 'copy', 'connect', 'watch']);
139139

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Pattern states should be lowercase and use hyphens where spaces are present.
7474
```
7575

7676
##### Pattern Parameters
77-
attern parameters are a simple mechanism for replacing Mustache variables via attributes on a pattern partial tag rather than having to use a pattern-specific json file. They are especially useful when you want to supply distinct values for Mustache variables in a specific pattern partial instance that may be included multiple times in a molecule, template, or page.
77+
Pattern parameters are a simple mechanism for replacing Mustache variables via attributes on a pattern partial tag rather than having to use a pattern-specific json file. They are especially useful when you want to supply distinct values for Mustache variables in a specific pattern partial instance that may be included multiple times in a molecule, template, or page.
7878

7979
The basic syntax is this:
8080

builder/lineage_hunter.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.10.0 - 2015
2+
* patternlab-node - v0.10.1 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.
@@ -25,6 +25,11 @@
2525
//strip out the template cruft
2626
var foundPattern = match.replace("{{> ", "").replace(" }}", "").replace("{{>", "").replace("}}", "");
2727

28+
// remove any potential pattern parameters. this and the above are rather brutish but I didn't want to do a regex at the time
29+
if(foundPattern.indexOf('(') > 0){
30+
foundPattern = foundPattern.substring(0, foundPattern.indexOf('('));
31+
}
32+
2833
//add if it doesnt exist
2934
if (pattern.lineageIndex.indexOf(foundPattern) === -1){
3035

builder/media_hunter.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.10.0 - 2015
2+
* patternlab-node - v0.10.1 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.
@@ -17,10 +17,10 @@
1717

1818
var media_hunter = function(){
1919

20-
function findMediaQueries(patternlab){
20+
function findMediaQueries(dir, patternlab){
2121
patternlab.mediaQueries = [];
2222

23-
diveSync('./source/css', function(err, file){
23+
diveSync(dir, function(err, file){
2424
if(path.extname(file) === '.css'){
2525
var contents = fs.readFileSync(file, 'utf8');
2626
var safeContents = contents.replace("\r", " ").replace("\n", " ");
@@ -33,13 +33,16 @@
3333
}
3434
}
3535
});
36-
//alpha sort for now, but should meet most use-cases except greater than 100ems. you are using ems right?
37-
patternlab.mediaQueries.sort();
36+
patternlab.mediaQueries.sort(function(a,b){
37+
var integerPartA = a.match(/(?:\d*\.)?\d+/g);
38+
var integerPartB = b.match(/(?:\d*\.)?\d+/g);
39+
return parseInt(a,10) > parseInt(b,10);
40+
});
3841
}
3942

4043
return {
41-
find_media_queries: function(patternlab){
42-
findMediaQueries(patternlab);
44+
find_media_queries: function(dir, patternlab){
45+
findMediaQueries(dir, patternlab);
4346
}
4447
};
4548

builder/object_factory.js

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

builder/parameter_hunter.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.10.0 - 2015
2+
* patternlab-node - v0.10.1 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.
@@ -40,15 +40,14 @@
4040
var paramData = eval(paramString);
4141

4242
//compile this partial immeadiately, essentially consuming it.
43-
//TODO: see how this affects lineage. perhaps add manually here.
4443
var partialPattern = pattern_assembler.get_pattern_by_key(partialName, patternlab);
4544
var existingData = pattern.data || patternlab.data;
4645

4746
//merge paramData with any other data that exists.
4847
for (var prop in paramData) {
4948
if (existingData.hasOwnProperty(prop)) {
5049
existingData[prop] = paramData[prop];
51-
}
50+
}
5251
}
5352

5453
//extend pattern data links into link for pattern link shortcuts to work. we do this locally and globally
@@ -57,9 +56,6 @@
5756

5857
//remove the parameter from the partial and replace it with the rendered partial + paramData
5958
pattern.extendedTemplate = pattern.extendedTemplate.replace(pMatch, renderedPartial);
60-
61-
//TODO: lineage is missing for this pattern
62-
6359
});
6460
}
6561
}

builder/pattern_assembler.js

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

builder/pattern_exporter.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/*
2-
* patternlab-node - v0.10.0 - 2015
3-
*
1+
/*
2+
* patternlab-node - v0.10.1 - 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/patternlab.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v0.10.0 - 2015
2+
* patternlab-node - v0.10.1 - 2015
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.
@@ -113,7 +113,7 @@ var patternlab_engine = function () {
113113
patternlab.viewAllPaths = {};
114114

115115
//find mediaQueries
116-
media_hunter.find_media_queries(patternlab);
116+
media_hunter.find_media_queries('./source/css', patternlab);
117117

118118
//build the styleguide
119119
var styleguideTemplate = fs.readFileSync('./source/_patternlab-files/styleguide.mustache', 'utf8'),

0 commit comments

Comments
 (0)