Skip to content

Commit 5eb168e

Browse files
author
Brian Muenzenmeyer
committed
Merge pull request #261 from pattern-lab/dev
Pattern Lab Version 1.1.2
2 parents 636342c + 97498c7 commit 5eb168e

18 files changed

+93
-30
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**Target the `dev` branch!**
1+
<!-- **Please read the contribution guidelines first, and target the `dev` branch!** -->
22

33
Addresses #
44

CHANGELOG

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

3+
PL-node-v1.1.2
4+
- 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.
5+
- THX: Thanks to @geoffp for taking the lead on this issue.
6+
- THX: This release also marks the first with @geoff's more official involvement with the project as a core contributor. His work on the `pattern_engine` branch and configurable paths have and will continue to make Pattern Lab Node better.
7+
- FIX: Replace `eval()` with a smarter `JSON.parse()` call within the `parameter_hunter.js`
8+
- THX: Thanks to @e2tha-e for taking the high road!
9+
310
PL-node-v1.1.1
411
- FIX: Fixed issue where alternate patterns are added to end of styleguide instead of inline with their parent pattern.
512

Gruntfile.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,36 @@ module.exports = function(grunt) {
101101
ignoreInitial: true,
102102
ignored: '*.html'
103103
},
104+
snippetOptions: {
105+
// Ignore all HTML files within the templates folder
106+
blacklist: ['/index.html', '/']
107+
},
104108
plugins: [
105109
{
106110
module: 'bs-html-injector',
107111
options: {
108112
files: [path.resolve(paths().public.root + '/index.html'), path.resolve(paths().public.styleguide + '/styleguide.html')]
109113
}
110114
}
111-
]
115+
],
116+
notify: {
117+
styles: [
118+
'display: none',
119+
'padding: 15px',
120+
'font-family: sans-serif',
121+
'position: fixed',
122+
'font-size: 1em',
123+
'z-index: 9999',
124+
'bottom: 0px',
125+
'right: 0px',
126+
'border-top-left-radius: 5px',
127+
'background-color: #1B2032',
128+
'opacity: 0.4',
129+
'margin: 0',
130+
'color: white',
131+
'text-align: center'
132+
]
133+
}
112134
}
113135
}
114136
},

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 - v1.1.1 - 2016
2+
* patternlab-node - v1.1.2 - 2016
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 - v1.1.1 - 2016
2+
* patternlab-node - v1.1.2 - 2016
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 - v1.1.1 - 2016
2+
* patternlab-node - v1.1.2 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

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 - v1.1.1 - 2016
2+
* patternlab-node - v1.1.2 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

builder/parameter_hunter.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v1.1.1 - 2016
2+
* patternlab-node - v1.1.2 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.
@@ -35,16 +35,28 @@
3535
console.log('found patternParameters for ' + partialName);
3636
}
3737

38-
//strip out the additional data and eval
38+
//strip out the additional data, convert string to JSON.
3939
var leftParen = pMatch.indexOf('(');
4040
var rightParen = pMatch.indexOf(')');
41-
var paramString = '({' + pMatch.substring(leftParen + 1, rightParen) + '})';
42-
43-
//do no evil. there is no good way to do this that I can think of without using a split, which then makes commas and colons special characters and unusable within the pattern params
44-
var paramData = eval(paramString);
45-
46-
var globalData = JSON.parse(JSON.stringify(patternlab.data));
47-
var localData = JSON.parse(JSON.stringify(pattern.jsonFileData || {}));
41+
var paramString = '{' + pMatch.substring(leftParen + 1, rightParen) + '}';
42+
//if param keys are wrapped in single quotes, replace with double quotes.
43+
var paramStringWellFormed = paramString.replace(/(')([^']+)(')(\s*\:)/gm, '"$2"$4');
44+
//if params keys are not wrapped in any quotes, wrap in double quotes.
45+
var paramStringWellFormed = paramStringWellFormed.replace(/([\{|,]\s*)([^\:\s]+)(\s*\:)/gm, '$1"$2"$3');
46+
//if param values are wrapped in single quotes, replace with double quotes.
47+
var paramStringWellFormed = paramStringWellFormed.replace(/(\:\s*)(')([^']+)(')/gm, '$1"$3"');
48+
49+
var paramData = {};
50+
var globalData = {};
51+
var localData = {};
52+
53+
try {
54+
paramData = JSON.parse(paramStringWellFormed);
55+
globalData = JSON.parse(JSON.stringify(patternlab.data));
56+
localData = JSON.parse(JSON.stringify(pattern.jsonFileData || {}));
57+
} catch(e){
58+
console.log(e);
59+
}
4860

4961
var allData = pattern_assembler.merge_data(globalData, localData);
5062
allData = pattern_assembler.merge_data(allData, paramData);

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 - v1.1.1 - 2016
2+
* patternlab-node - v1.1.2 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

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 - v1.1.1 - 2016
2+
* patternlab-node - v1.1.2 - 2016
33
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.

0 commit comments

Comments
 (0)