Skip to content
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
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
THIS CHANGELOG IS AN ATTEMPT TO DOCUMENT CHANGES TO THIS PROJECT.

PL-node-v0.15.1
- FIX: Resolve issue with styleModifiers not being replaced when the partial has spaces in it.
- ADD: Support multiple styleModifier classes using the | pipe syntax
- FIX: Resolve issue with styleModifiers not being applied correctly when mixed with pattern parameters
- THX: Thanks @theorise for the issue reports!

PL-node-v0.15.0
- CHG: Updated package.json devDependencies for Node 4.X and 5.X support.
- CHG: Updated package.gulp.json devDependencies for Node 4.X and 5.X support.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Contributing to Patternlab - Node
If you'd like to contribute to patternlab - node, please do so! There is always a lot of ground to cover, with patternlab - php being so feature-rich.

No pull request is too small.
No pull request is too small. Check out any [up for grabs issues](https://github.com/pattern-lab/patternlab-node/labels/up%20for%20grabs) as a good way to get your feet wet.

##Guidelines
1. Please keep your pull requests concise and limited to **ONE** substantive change at a time.
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ It's not expected to toggle between the two build systems, but for those migrati

### Upgrading

You can find some simple upgrade documenation in it's current home here (unreleased but confirmed to work): [https://github.com/pattern-lab/website/blob/dev/patternlabsite/docs/node/upgrading.md](https://github.com/pattern-lab/website/blob/dev/patternlabsite/docs/node/upgrading.md)
You can find instructions on how to upgrade from version to version of Pattern Lab Node here: [https://github.com/pattern-lab/patternlab-node/wiki/Upgrading](https://github.com/pattern-lab/patternlab-node/wiki/Upgrading)

### Command Line Interface

Expand Down Expand Up @@ -212,6 +212,11 @@ Once rendered, it looks like this:
</div>
```

You may also specify multiple classes using a pipe character (|).

```
{{> atoms-message:error|is-on }}
```



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 - v0.15.0 - 2015
* patternlab-node - v0.15.1 - 2015
*
* 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 - v0.15.0 - 2015
* patternlab-node - v0.15.1 - 2015
*
* 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 - v0.15.0 - 2015
* patternlab-node - v0.15.1 - 2015
*
* 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 - v0.15.0 - 2015
* patternlab-node - v0.15.1 - 2015
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
14 changes: 8 additions & 6 deletions builder/parameter_hunter.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* patternlab-node - v0.15.0 - 2015
*
/*
* patternlab-node - v0.15.1 - 2015
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
*
*/

Expand All @@ -28,6 +28,8 @@
//find the partial's name and retrieve it
var partialName = pMatch.match(/([\w\-\.\/~]+)/g)[0];
var partialPattern = pattern_assembler.get_pattern_by_key(partialName, patternlab);
//if we retrieved a pattern we should make sure that its extendedTemplate is reset. looks to fix #190
partialPattern.extendedTemplate = partialPattern.template;

if(patternlab.config.debug){
console.log('found patternParameters for ' + partialName);
Expand Down
22 changes: 11 additions & 11 deletions builder/pattern_assembler.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* patternlab-node - v0.15.0 - 2015
*
/*
* patternlab-node - v0.15.1 - 2015
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
*
*/

Expand All @@ -24,19 +24,19 @@

// returns any patterns that match {{> value:mod }} or {{> value:mod(foo:"bar") }} within the pattern
function findPartialsWithStyleModifiers(pattern){
var matches = pattern.template.match(/{{>([ ])?([\w\-\.\/~]+)(?!\()(\:[A-Za-z0-9-_]+)+(?:(| )\(.*)?([ ])?}}/g);
var matches = pattern.template.match(/{{>([ ])?([\w\-\.\/~]+)(?!\()(\:[A-Za-z0-9-_|]+)+(?:(| )\(.*)?([ ])?}}/g);
return matches;
}

// returns any patterns that match {{> value(foo:"bar") }} or {{> value:mod(foo:"bar") }} within the pattern
function findPartialsWithPatternParameters(pattern){
var matches = pattern.template.match(/{{>([ ])?([\w\-\.\/~]+)(?:\:[A-Za-z0-9-_]+)?(?:(| )\(.*)+([ ])?}}/g);
var matches = pattern.template.match(/{{>([ ])?([\w\-\.\/~]+)(?:\:[A-Za-z0-9-_|]+)?(?:(| )\(.*)+([ ])?}}/g);
return matches;
}

//find and return any {{> template-name* }} within pattern
function findPartials(pattern){
var matches = pattern.template.match(/{{>([ ])?([\w\-\.\/~]+)(?:\:[A-Za-z0-9-_]+)?(?:(| )\(.*)?([ ])?}}/g);
var matches = pattern.template.match(/{{>([ ])?([\w\-\.\/~]+)(?:\:[A-Za-z0-9-_|]+)?(?:(| )\(.*)?([ ])?}}/g);
return matches;
}

Expand Down Expand Up @@ -207,7 +207,7 @@

//do something with the regular old partials
for(i = 0; i < foundPatternPartials.length; i++){
var partialKey = foundPatternPartials[i].replace(/{{>([ ])?([\w\-\.\/~]+)(:[A-z-_]+)?(?:\:[A-Za-z0-9-]+)?(?:(| )\(.*)?([ ])?}}/g, '$2');
var partialKey = foundPatternPartials[i].replace(/{{>([ ])?([\w\-\.\/~]+)(:[A-z-_|]+)?(?:\:[A-Za-z0-9-_]+)?(?:(| )\(.*)?([ ])?}}/g, '$2');

var partialPath;

Expand Down Expand Up @@ -262,7 +262,7 @@
throw 'Could not find pattern with key ' + key;
}


function mergeData(obj1, obj2){
if(typeof obj2 === 'undefined'){
obj2 = {};
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 - v0.15.0 - 2015
* patternlab-node - v0.15.1 - 2015
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
2 changes: 1 addition & 1 deletion builder/patternlab.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v0.15.0 - 2015
* patternlab-node - v0.15.1 - 2015
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
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 - v0.15.0 - 2015
* patternlab-node - v0.15.1 - 2015
*
* 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 - v0.15.0 - 2015
* patternlab-node - v0.15.1 - 2015
*
* 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 - v0.15.0 - 2015
* patternlab-node - v0.15.1 - 2015
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
19 changes: 11 additions & 8 deletions builder/style_modifier_hunter.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* patternlab-node - v0.15.0 - 2015
*
/*
* patternlab-node - v0.15.1 - 2015
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
*
*/

Expand All @@ -16,15 +16,18 @@
function consumestylemodifier(pattern, partial, patternlab){

//extract the classname from the stylemodifier which comes in the format of :className
var styleModifier = partial.match(/:([\w\-_])+/g) ? partial.match(/:([\w\-_])+/g)[0].slice(1) : null;
var styleModifier = partial.match(/:([\w\-_|])+/g) ? partial.match(/:([\w\-_|])+/g)[0].slice(1) : null;
if(styleModifier){

//replace the special character pipe | used to separate multiple classes with a space
styleModifier = styleModifier.replace(/\|/g, ' ');

if(patternlab.config.debug){
console.log('found partial styleModifier within pattern ' + pattern.key);
}

//replace the stylemodifier placeholder with the class name
pattern.extendedTemplate = pattern.extendedTemplate.replace('{{styleModifier}}', styleModifier);
pattern.extendedTemplate = pattern.extendedTemplate.replace(/{{[ ]?styleModifier[ ]?}}/i, styleModifier);
}
}

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": "0.15.0",
"version": "0.15.1",
"devDependencies": {
"browser-sync": "^2.10.0",
"del": "^2.0.2",
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": "0.15.0",
"version": "0.15.1",
"devDependencies": {
"bs-html-injector": "^3.0.0",
"diveSync": "^0.3.0",
Expand Down
3 changes: 3 additions & 0 deletions test/files/_patterns/00-test/03-styled-atom.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<span class="test_base {{styleModifier}}">
{{message}}
</span>
6 changes: 6 additions & 0 deletions test/files/_patterns/00-test/04-group.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="test_group">
{{> test-styled-atom:test_1 }}
{{> test-styled-atom:test_2 }}
{{> test-styled-atom:test_3 }}
{{> test-styled-atom:test_4 }}
</div>
6 changes: 6 additions & 0 deletions test/files/_patterns/00-test/05-group2.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="test_group">
{{> test-styled-atom:test_1(message: "1" ) }}
{{> test-styled-atom:test_2(message: "2" ) }}
{{> test-styled-atom:test_3(message: "3" ) }}
{{> test-styled-atom:test_4(message: "4" ) }}
</div>
6 changes: 6 additions & 0 deletions test/files/_patterns/00-test/06-mixed.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="test_group">
{{> test-styled-atom }}
{{> test-styled-atom:test_2 }}
{{> test-styled-atom:test_3 }}
{{> test-styled-atom:test_4 }}
</div>
6 changes: 6 additions & 0 deletions test/files/_patterns/00-test/07-mixed-params.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="test_group">
{{> test-styled-atom }}
{{> test-styled-atom:test_2(message: '2') }}
{{> test-styled-atom:test_3(message: '3') }}
{{> test-styled-atom:test_4(message: '4') }}
</div>
6 changes: 6 additions & 0 deletions test/files/_patterns/00-test/08-bookend-params.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="test_group">
{{> test-styled-atom }}
{{> test-styled-atom:test_2(message: '2') }}
{{> test-styled-atom:test_3(message: '3') }}
{{> test-styled-atom }}
</div>
6 changes: 6 additions & 0 deletions test/files/_patterns/00-test/09-bookend.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="test_group">
{{> test-styled-atom }}
{{> test-styled-atom:test_2 }}
{{> test-styled-atom:test_3 }}
{{> test-styled-atom}}
</div>
Loading