Skip to content

Commit

Permalink
Merge pull request #261 from pattern-lab/dev
Browse files Browse the repository at this point in the history
Pattern Lab Version 1.1.2
  • Loading branch information
Brian Muenzenmeyer committed Feb 23, 2016
2 parents 636342c + 97498c7 commit 5eb168e
Show file tree
Hide file tree
Showing 18 changed files with 93 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**Target the `dev` branch!**
<!-- **Please read the contribution guidelines first, and target the `dev` branch!** -->

Addresses #

Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
THIS CHANGELOG IS AN ATTEMPT TO DOCUMENT CHANGES TO THIS PROJECT.

PL-node-v1.1.2
- 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.
- THX: Thanks to @geoffp for taking the lead on this issue.
- 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.
- FIX: Replace `eval()` with a smarter `JSON.parse()` call within the `parameter_hunter.js`
- THX: Thanks to @e2tha-e for taking the high road!

PL-node-v1.1.1
- FIX: Fixed issue where alternate patterns are added to end of styleguide instead of inline with their parent pattern.

Expand Down
24 changes: 23 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,36 @@ module.exports = function(grunt) {
ignoreInitial: true,
ignored: '*.html'
},
snippetOptions: {
// Ignore all HTML files within the templates folder
blacklist: ['/index.html', '/']
},
plugins: [
{
module: 'bs-html-injector',
options: {
files: [path.resolve(paths().public.root + '/index.html'), path.resolve(paths().public.styleguide + '/styleguide.html')]
}
}
]
],
notify: {
styles: [
'display: none',
'padding: 15px',
'font-family: sans-serif',
'position: fixed',
'font-size: 1em',
'z-index: 9999',
'bottom: 0px',
'right: 0px',
'border-top-left-radius: 5px',
'background-color: #1B2032',
'opacity: 0.4',
'margin: 0',
'color: white',
'text-align: center'
]
}
}
}
},
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 - v1.1.1 - 2016
* patternlab-node - v1.1.2 - 2016
*
* 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 - v1.1.1 - 2016
* patternlab-node - v1.1.2 - 2016
*
* 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 - v1.1.1 - 2016
* patternlab-node - v1.1.2 - 2016
*
* 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 - v1.1.1 - 2016
* patternlab-node - v1.1.2 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
30 changes: 21 additions & 9 deletions builder/parameter_hunter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.1 - 2016
* patternlab-node - v1.1.2 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down Expand Up @@ -35,16 +35,28 @@
console.log('found patternParameters for ' + partialName);
}

//strip out the additional data and eval
//strip out the additional data, convert string to JSON.
var leftParen = pMatch.indexOf('(');
var rightParen = pMatch.indexOf(')');
var paramString = '({' + pMatch.substring(leftParen + 1, rightParen) + '})';

//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
var paramData = eval(paramString);

var globalData = JSON.parse(JSON.stringify(patternlab.data));
var localData = JSON.parse(JSON.stringify(pattern.jsonFileData || {}));
var paramString = '{' + pMatch.substring(leftParen + 1, rightParen) + '}';
//if param keys are wrapped in single quotes, replace with double quotes.
var paramStringWellFormed = paramString.replace(/(')([^']+)(')(\s*\:)/gm, '"$2"$4');
//if params keys are not wrapped in any quotes, wrap in double quotes.
var paramStringWellFormed = paramStringWellFormed.replace(/([\{|,]\s*)([^\:\s]+)(\s*\:)/gm, '$1"$2"$3');
//if param values are wrapped in single quotes, replace with double quotes.
var paramStringWellFormed = paramStringWellFormed.replace(/(\:\s*)(')([^']+)(')/gm, '$1"$3"');

var paramData = {};
var globalData = {};
var localData = {};

try {
paramData = JSON.parse(paramStringWellFormed);
globalData = JSON.parse(JSON.stringify(patternlab.data));
localData = JSON.parse(JSON.stringify(pattern.jsonFileData || {}));
} catch(e){
console.log(e);
}

var allData = pattern_assembler.merge_data(globalData, localData);
allData = pattern_assembler.merge_data(allData, paramData);
Expand Down
2 changes: 1 addition & 1 deletion builder/pattern_assembler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.1 - 2016
* patternlab-node - v1.1.2 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
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 - v1.1.1 - 2016
* patternlab-node - v1.1.2 - 2016
*
* 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 - v1.1.1 - 2016
* patternlab-node - v1.1.2 - 2016
*
* 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 - v1.1.1 - 2016
* patternlab-node - v1.1.2 - 2016
*
* 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 - v1.1.1 - 2016
* patternlab-node - v1.1.2 - 2016
*
* 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 - v1.1.1 - 2016
* patternlab-node - v1.1.2 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
2 changes: 1 addition & 1 deletion builder/style_modifier_hunter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v1.1.1 - 2016
* patternlab-node - v1.1.2 - 2016
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
Expand Down
34 changes: 28 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,39 @@ gulp.task('cp:css', function(){
// Styleguide Copy
gulp.task('cp:styleguide', function(){
return gulp.src(
[ '**/*'],
{cwd: path.resolve(paths().source.styleguide)} )
['**/*'],
{cwd: path.resolve(paths().source.styleguide)})
.pipe(gulp.dest(path.resolve(paths().public.styleguide)))
.pipe(browserSync.stream());;
.pipe(browserSync.stream());
});

//server and watch tasks
gulp.task('connect', ['lab'], function(){
// server and watch tasks
gulp.task('connect', ['lab'], function () {
browserSync.init({
server: {
baseDir: path.resolve(paths().public.root)
},
snippetOptions: {
// Ignore all HTML files within the templates folder
blacklist: ['/index.html', '/']
},
notify: {
styles: [
'display: none',
'padding: 15px',
'font-family: sans-serif',
'position: fixed',
'font-size: 1em',
'z-index: 9999',
'bottom: 0px',
'right: 0px',
'border-top-left-radius: 5px',
'background-color: #1B2032',
'opacity: 0.4',
'margin: 0',
'color: white',
'text-align: center'
]
}
});
gulp.watch(path.resolve(paths().source.css, '**/*.css'), ['cp:css']);
Expand All @@ -120,7 +142,7 @@ gulp.task('connect', ['lab'], function(){
path.resolve(paths().source.data, '*.json'),
path.resolve(paths().source.fonts + '/*'),
path.resolve(paths().source.images + '/*'),
path.resolve(paths().source.data + '*.json'),
path.resolve(paths().source.data + '*.json')
],
['lab-pipe'],
function () { browserSync.reload(); }
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": "1.1.1",
"version": "1.1.2",
"main": "./builder/patternlab.js",
"dependencies": {
"del": "^2.2.0",
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": "1.1.1",
"version": "1.1.2",
"main": "./builder/patternlab.js",
"dependencies": {
"diveSync": "^0.3.0",
Expand Down

0 comments on commit 5eb168e

Please sign in to comment.