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
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: node_js

node_js:
- 4.1
- 4.0
- 0.12
- 0.11

Expand Down
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-v0.13.1
- FIX: Allow verbose partials for list items
- THX: Thanks @e2tha-e

PL-node-v0.13.0
- FIX: Cleanup an old file and an incorrect entry in the .gitignore file
- CHG: Change order of pattern addition and ~variant pattern addition so they build naturally in the menu.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This repository contains the vanilla builder logic, grunt and gulp configuration

* Download the [latest release of patternlab-node](https://github.com/pattern-lab/patternlab-node/releases/latest) from Github
* Via npm, run `npm install patternlab-node` (Note this will auto install the grunt version currently. see below)
* **NOTE** Node version 4.X is not officially supported yet, 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.

### Choose Your Adventure! Now Vanilla, Grunt & Gulp

Expand Down
2 changes: 1 addition & 1 deletion builder/list_item_hunter.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
for(var j = 0; j < foundPartials.length; j++){

//get the partial
var partialName = foundPartials[j].match(/([a-z-]+)/ig)[0];
var partialName = foundPartials[j].match(/([\w\-\.\/~]+)/g)[0];
var partialPattern = pattern_assembler.get_pattern_by_key(partialName, patternlab);

//replace its reference within the block with the extended template
Expand Down
67 changes: 67 additions & 0 deletions test/list_item_hunter_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,73 @@
test.done();
},

'process_list_item_partials finds verbose partials and outputs repeated renders' : function(test){
var pattern1 = {
"template": "{{#listItems.one}}{{> 00-test/00-foo }}{{/listItems.one}}",
"extendedTemplate" : "{{#listItems.one}}{{> 00-test/00-foo }}{{/listItems.one}}",
"key": "test-patternName1",
"jsonFileData" : {}
};

var pattern2 = {
"template": "{{#listItems.two}}{{> 00-test/01-bar.mustache }}{{/listItems.two}}",
"extendedTemplate" : "{{#listItems.two}}{{> 00-test/01-bar.mustache }}{{/listItems.two}}",
"key": "test-patternName2",
"jsonFileData" : {}
};

var patternlab = {
"listitems": {
"1": [
{
"title": "Foo"
}
],
"2": [
{
"title": "Foo"
},
{
"title": "Bar"
}
]
},
"data": {
"link": {},
"partials": []
},
"config": {"debug": false},
"patterns": [
{
"template": "{{ title }}",
"extendedTemplate" : "{{ title }}",
"subdir": "00-test",
"fileName": "00-foo",
"jsonFileData" : {}
},
{
"template": "{{ title }}",
"extendedTemplate" : "{{ title }}",
"subdir": "00-test",
"fileName": "01-bar",
"jsonFileData" : {}
}
]
};

var list_item_hunter = new lih();

//act
list_item_hunter.process_list_item_partials(pattern1, patternlab);
list_item_hunter.process_list_item_partials(pattern2, patternlab);

//assert
test.equals(pattern1.extendedTemplate, "Foo" );
test.equals(pattern2.extendedTemplate, "FooBar" );

test.done();
},

'process_list_item_partials overwrites listItem property if that property is in local .listitem.json' : function(test){
//arrange
//setup current pattern from what we would have during execution
Expand Down