diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index bbe1ddf1f..4ddf5e12d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,4 +1,4 @@ -**Target the `dev` branch!** + Addresses # diff --git a/CHANGELOG b/CHANGELOG index 491f1ddab..c2b2fea19 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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. diff --git a/Gruntfile.js b/Gruntfile.js index 7b57f6385..06c6cf6d2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -101,6 +101,10 @@ 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', @@ -108,7 +112,25 @@ module.exports = function(grunt) { 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' + ] + } } } }, diff --git a/builder/lineage_hunter.js b/builder/lineage_hunter.js index 999bfb94b..8a8616006 100644 --- a/builder/lineage_hunter.js +++ b/builder/lineage_hunter.js @@ -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. diff --git a/builder/list_item_hunter.js b/builder/list_item_hunter.js index 44688fa8c..7e0bc8217 100644 --- a/builder/list_item_hunter.js +++ b/builder/list_item_hunter.js @@ -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. diff --git a/builder/media_hunter.js b/builder/media_hunter.js index 10bf885f8..b532c91bb 100644 --- a/builder/media_hunter.js +++ b/builder/media_hunter.js @@ -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. diff --git a/builder/object_factory.js b/builder/object_factory.js index 4e91e110c..bf1770855 100644 --- a/builder/object_factory.js +++ b/builder/object_factory.js @@ -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. diff --git a/builder/parameter_hunter.js b/builder/parameter_hunter.js index cee16596b..71daf51c5 100644 --- a/builder/parameter_hunter.js +++ b/builder/parameter_hunter.js @@ -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. @@ -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); diff --git a/builder/pattern_assembler.js b/builder/pattern_assembler.js index e45e37982..888fd09e2 100644 --- a/builder/pattern_assembler.js +++ b/builder/pattern_assembler.js @@ -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. diff --git a/builder/pattern_exporter.js b/builder/pattern_exporter.js index 24b751cfa..3a70bea98 100644 --- a/builder/pattern_exporter.js +++ b/builder/pattern_exporter.js @@ -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. diff --git a/builder/patternlab.js b/builder/patternlab.js index d68c3e14b..2404d6c9a 100644 --- a/builder/patternlab.js +++ b/builder/patternlab.js @@ -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. diff --git a/builder/patternlab_grunt.js b/builder/patternlab_grunt.js index b04deefac..7f22c987f 100644 --- a/builder/patternlab_grunt.js +++ b/builder/patternlab_grunt.js @@ -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. diff --git a/builder/patternlab_gulp.js b/builder/patternlab_gulp.js index 956b20f01..a0125e657 100644 --- a/builder/patternlab_gulp.js +++ b/builder/patternlab_gulp.js @@ -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. diff --git a/builder/pseudopattern_hunter.js b/builder/pseudopattern_hunter.js index b262d1a3c..f2765aaa5 100644 --- a/builder/pseudopattern_hunter.js +++ b/builder/pseudopattern_hunter.js @@ -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. diff --git a/builder/style_modifier_hunter.js b/builder/style_modifier_hunter.js index b3402888d..11cce9d27 100644 --- a/builder/style_modifier_hunter.js +++ b/builder/style_modifier_hunter.js @@ -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. diff --git a/gulpfile.js b/gulpfile.js index f8ad52f35..a481efccd 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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']); @@ -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(); } diff --git a/package.gulp.json b/package.gulp.json index 7e83badca..9130aca63 100644 --- a/package.gulp.json +++ b/package.gulp.json @@ -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", diff --git a/package.json b/package.json index 508a67686..47ac92da2 100644 --- a/package.json +++ b/package.json @@ -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",