From 211b2334c8443b6923772902ecf0dc2a358e1a1a Mon Sep 17 00:00:00 2001 From: BRIAN MUENZENMEYER Date: Wed, 2 Mar 2016 09:39:15 -0600 Subject: [PATCH 1/5] moved builder/*.js files and fixed all references passing unit tests and building frontend #133 --- Gruntfile.js | 52 +++++++++---------- README.md | 4 +- {builder => core/lib}/lineage_hunter.js | 0 {builder => core/lib}/list_item_hunter.js | 0 {builder => core/lib}/media_hunter.js | 0 {builder => core/lib}/object_factory.js | 0 {builder => core/lib}/parameter_hunter.js | 0 {builder => core/lib}/pattern_assembler.js | 0 {builder => core/lib}/pattern_exporter.js | 0 {builder => core/lib}/patternlab.js | 2 +- {builder => core/lib}/patternlab_grunt.js | 0 {builder => core/lib}/patternlab_gulp.js | 0 {builder => core/lib}/pseudopattern_hunter.js | 0 .../lib}/style_modifier_hunter.js | 0 gulpfile.js | 30 +++++------ package.gulp.json | 2 +- package.json | 2 +- test/lineage_hunter_tests.js | 2 +- test/list_item_hunter_tests.js | 6 +-- test/media_hunter_tests.js | 2 +- test/object_factory_tests.js | 2 +- test/parameter_hunter_tests.js | 2 +- test/pattern_assembler_tests.js | 14 ++--- test/pseudopattern_hunter_tests.js | 6 +-- test/style_modifier_hunter_tests.js | 2 +- 25 files changed, 64 insertions(+), 64 deletions(-) rename {builder => core/lib}/lineage_hunter.js (100%) rename {builder => core/lib}/list_item_hunter.js (100%) rename {builder => core/lib}/media_hunter.js (100%) rename {builder => core/lib}/object_factory.js (100%) rename {builder => core/lib}/parameter_hunter.js (100%) rename {builder => core/lib}/pattern_assembler.js (100%) rename {builder => core/lib}/pattern_exporter.js (100%) rename {builder => core/lib}/patternlab.js (99%) rename {builder => core/lib}/patternlab_grunt.js (100%) rename {builder => core/lib}/patternlab_gulp.js (100%) rename {builder => core/lib}/pseudopattern_hunter.js (100%) rename {builder => core/lib}/style_modifier_hunter.js (100%) diff --git a/Gruntfile.js b/Gruntfile.js index 2dfa9be8a..2f5dc2ad3 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -15,52 +15,52 @@ module.exports = function (grunt) { banner: '/* \n * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy") %> \n * \n * <%= pkg.author %>, and the web community.\n * Licensed under the <%= pkg.license %> license. \n * \n * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice. \n *\n */\n\n', }, patternlab: { - src: './builder/patternlab.js', - dest: './builder/patternlab.js' + src: './core/lib/patternlab.js', + dest: './core/lib/patternlab.js' }, object_factory: { - src: './builder/object_factory.js', - dest: './builder/object_factory.js' + src: './core/lib/object_factory.js', + dest: './core/lib/object_factory.js' }, lineage: { - src: './builder/lineage_hunter.js', - dest: './builder/lineage_hunter.js' + src: './core/lib/lineage_hunter.js', + dest: './core/lib/lineage_hunter.js' }, media_hunter: { - src: './builder/media_hunter.js', - dest: './builder/media_hunter.js' + src: './core/lib/media_hunter.js', + dest: './core/lib/media_hunter.js' }, patternlab_grunt: { - src: './builder/patternlab_grunt.js', - dest: './builder/patternlab_grunt.js' + src: './core/lib/patternlab_grunt.js', + dest: './core/lib/patternlab_grunt.js' }, patternlab_gulp: { - src: './builder/patternlab_gulp.js', - dest: './builder/patternlab_gulp.js' + src: './core/lib/patternlab_gulp.js', + dest: './core/lib/patternlab_gulp.js' }, parameter_hunter: { - src: './builder/parameter_hunter.js', - dest: './builder/parameter_hunter.js' + src: './core/lib/parameter_hunter.js', + dest: './core/lib/parameter_hunter.js' }, pattern_exporter: { - src: './builder/pattern_exporter.js', - dest: './builder/pattern_exporter.js' + src: './core/lib/pattern_exporter.js', + dest: './core/lib/pattern_exporter.js' }, pattern_assembler: { - src: './builder/pattern_assembler.js', - dest: './builder/pattern_assembler.js' + src: './core/lib/pattern_assembler.js', + dest: './core/lib/pattern_assembler.js' }, pseudopattern_hunter: { - src: './builder/pseudopattern_hunter.js', - dest: './builder/pseudopattern_hunter.js' + src: './core/lib/pseudopattern_hunter.js', + dest: './core/lib/pseudopattern_hunter.js' }, list_item_hunter: { - src: './builder/list_item_hunter.js', - dest: './builder/list_item_hunter.js' + src: './core/lib/list_item_hunter.js', + dest: './core/lib/list_item_hunter.js' }, style_modifier_hunter: { - src: './builder/style_modifier_hunter.js', - dest: './builder/style_modifier_hunter.js' + src: './core/lib/style_modifier_hunter.js', + dest: './core/lib/style_modifier_hunter.js' } }, copy: { @@ -142,7 +142,7 @@ module.exports = function (grunt) { options: { configFile: './.eslintrc' }, - target: ['./builder/*'] + target: ['./core/lib/*'] }, bsReload: { css: path.resolve(paths().public.root + '**/*.css') @@ -153,7 +153,7 @@ module.exports = function (grunt) { require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); //load the patternlab task - grunt.task.loadTasks('./builder/'); + grunt.task.loadTasks('./core/lib/'); grunt.registerTask('default', ['patternlab', 'copy:main', 'copy:styleguide']); diff --git a/README.md b/README.md index 156abd8ac..c934f0738 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,8 @@ This repository ships with two `package.json` files, a `Gruntfile.js`, and a `gu To run patternlab-node using grunt, do the following in the directory you downloaded and extracted the zipped release: 1. Run `npm install` from the command line -2. Optionally, delete `package.gulp.json`, `gulpfile.js`, and `builder/patternlab_gulp.js` files if you are certain you don't need it. -* Not deleting `builder/patternlab_gulp.js` may cause a harmless error when running grunt. Delete it. +2. Optionally, delete `package.gulp.json`, `gulpfile.js`, and `core/lib/patternlab_gulp.js` files if you are certain you don't need it. +* Not deleting `core/lib/patternlab_gulp.js` may cause a harmless error when running grunt. Delete it. 3. Run `grunt` or `grunt serve` from the command line This creates all patterns, the styleguide, and the pattern lab site. It's strongly recommended to run `grunt serve` to have BrowserSync spin up and serve the files to you. diff --git a/builder/lineage_hunter.js b/core/lib/lineage_hunter.js similarity index 100% rename from builder/lineage_hunter.js rename to core/lib/lineage_hunter.js diff --git a/builder/list_item_hunter.js b/core/lib/list_item_hunter.js similarity index 100% rename from builder/list_item_hunter.js rename to core/lib/list_item_hunter.js diff --git a/builder/media_hunter.js b/core/lib/media_hunter.js similarity index 100% rename from builder/media_hunter.js rename to core/lib/media_hunter.js diff --git a/builder/object_factory.js b/core/lib/object_factory.js similarity index 100% rename from builder/object_factory.js rename to core/lib/object_factory.js diff --git a/builder/parameter_hunter.js b/core/lib/parameter_hunter.js similarity index 100% rename from builder/parameter_hunter.js rename to core/lib/parameter_hunter.js diff --git a/builder/pattern_assembler.js b/core/lib/pattern_assembler.js similarity index 100% rename from builder/pattern_assembler.js rename to core/lib/pattern_assembler.js diff --git a/builder/pattern_exporter.js b/core/lib/pattern_exporter.js similarity index 100% rename from builder/pattern_exporter.js rename to core/lib/pattern_exporter.js diff --git a/builder/patternlab.js b/core/lib/patternlab.js similarity index 99% rename from builder/patternlab.js rename to core/lib/patternlab.js index b4705deaf..128d95009 100644 --- a/builder/patternlab.js +++ b/core/lib/patternlab.js @@ -22,7 +22,7 @@ var patternlab_engine = function (config) { patternlab = {}; patternlab.package = fs.readJSONSync('./package.json'); - patternlab.config = config || fs.readJSONSync(path.resolve(__dirname, '../config.json')); + patternlab.config = config || fs.readJSONSync(path.resolve(__dirname, '../../config.json')); var paths = patternlab.config.paths; diff --git a/builder/patternlab_grunt.js b/core/lib/patternlab_grunt.js similarity index 100% rename from builder/patternlab_grunt.js rename to core/lib/patternlab_grunt.js diff --git a/builder/patternlab_gulp.js b/core/lib/patternlab_gulp.js similarity index 100% rename from builder/patternlab_gulp.js rename to core/lib/patternlab_gulp.js diff --git a/builder/pseudopattern_hunter.js b/core/lib/pseudopattern_hunter.js similarity index 100% rename from builder/pseudopattern_hunter.js rename to core/lib/pseudopattern_hunter.js diff --git a/builder/style_modifier_hunter.js b/core/lib/style_modifier_hunter.js similarity index 100% rename from builder/style_modifier_hunter.js rename to core/lib/style_modifier_hunter.js diff --git a/gulpfile.js b/gulpfile.js index a00019f2d..85e157f15 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -27,7 +27,7 @@ function paths() { } //load patternlab-node tasks -gulp.loadTasks(__dirname + '/builder/patternlab_gulp.js'); +gulp.loadTasks(__dirname + '/core/lib/patternlab_gulp.js'); //clean patterns dir gulp.task('clean', function (cb) { @@ -38,25 +38,25 @@ gulp.task('clean', function (cb) { //build the banner gulp.task('banner', function () { return gulp.src([ - './builder/patternlab.js', - './builder/object_factory.js', - './builder/lineage_hunter.js', - './builder/media_hunter.js', - './builder/patternlab_grunt.js', - './builder/patternlab_gulp.js', - './builder/parameter_hunter.js', - './builder/pattern_exporter.js', - './builder/pattern_assembler.js', - './builder/pseudopattern_hunter.js', - './builder/list_item_hunter.js', - './builder/style_modifier_hunter.js' + './core/lib/patternlab.js', + './core/lib/object_factory.js', + './core/lib/lineage_hunter.js', + './core/lib/media_hunter.js', + './core/lib/patternlab_grunt.js', + './core/lib/patternlab_gulp.js', + './core/lib/parameter_hunter.js', + './core/lib/pattern_exporter.js', + './core/lib/pattern_assembler.js', + './core/lib/pseudopattern_hunter.js', + './core/lib/list_item_hunter.js', + './core/lib/style_modifier_hunter.js' ]) .pipe(strip_banner()) .pipe(header(banner, { pkg : pkg, today : new Date().getFullYear() } )) - .pipe(gulp.dest('./builder')); + .pipe(gulp.dest('./core/lib')); }); @@ -154,7 +154,7 @@ gulp.task('connect', ['lab'], function () { //lint gulp.task('eslint', function () { - return gulp.src(['./builder/*.js', '!node_modules/**']) + return gulp.src(['./core/lib/*.js', '!node_modules/**']) .pipe(eslint()) .pipe(eslint.format()) .pipe(eslint.failAfterError()); diff --git a/package.gulp.json b/package.gulp.json index 87a4d0044..3bb48a781 100644 --- a/package.gulp.json +++ b/package.gulp.json @@ -2,7 +2,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.3", - "main": "./builder/patternlab.js", + "main": "./core/lib/patternlab.js", "dependencies": { "del": "^2.2.0", "diveSync": "^0.3.0", diff --git a/package.json b/package.json index a62664b52..68c810687 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,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.3", - "main": "./builder/patternlab.js", + "main": "./core/lib/patternlab.js", "dependencies": { "diveSync": "^0.3.0", "fs-extra": "^0.26.2", diff --git a/test/lineage_hunter_tests.js b/test/lineage_hunter_tests.js index 0cd6a4aea..490c704ec 100644 --- a/test/lineage_hunter_tests.js +++ b/test/lineage_hunter_tests.js @@ -1,7 +1,7 @@ (function () { "use strict"; - var lh = require('../builder/lineage_hunter'); + var lh = require('../core/lib/lineage_hunter'); exports['lineage hunter '] = { 'find_lineage - finds lineage' : function(test){ diff --git a/test/list_item_hunter_tests.js b/test/list_item_hunter_tests.js index b2895b24d..eb3ade6cf 100644 --- a/test/list_item_hunter_tests.js +++ b/test/list_item_hunter_tests.js @@ -1,9 +1,9 @@ (function () { "use strict"; - var lih = require('../builder/list_item_hunter'); - var pa = require('../builder/pattern_assembler'); - var object_factory = require('../builder/object_factory'); + var lih = require('../core/lib/list_item_hunter'); + var pa = require('../core/lib/pattern_assembler'); + var object_factory = require('../core/lib/object_factory'); exports['list_item_hunter'] = { 'process_list_item_partials finds and outputs basic repeating blocks' : function(test){ diff --git a/test/media_hunter_tests.js b/test/media_hunter_tests.js index e41db5f88..05ce5926b 100644 --- a/test/media_hunter_tests.js +++ b/test/media_hunter_tests.js @@ -1,7 +1,7 @@ (function () { "use strict"; - var MediaHunter = require('../builder/media_hunter'); + var MediaHunter = require('../core/lib/media_hunter'); exports['media_query hunter basic support '] = { 'test media hunter finds query' : function(test){ diff --git a/test/object_factory_tests.js b/test/object_factory_tests.js index f58b2e664..c3e736690 100644 --- a/test/object_factory_tests.js +++ b/test/object_factory_tests.js @@ -1,7 +1,7 @@ (function () { "use strict"; - var of = require('../builder/object_factory'); + var of = require('../core/lib/object_factory'); exports['oPattern initialization'] = { 'test oPattern initializes correctly' : function(test){ diff --git a/test/parameter_hunter_tests.js b/test/parameter_hunter_tests.js index 3672a4a79..96d345792 100644 --- a/test/parameter_hunter_tests.js +++ b/test/parameter_hunter_tests.js @@ -1,7 +1,7 @@ (function () { "use strict"; - var ph = require('../builder/parameter_hunter'); + var ph = require('../core/lib/parameter_hunter'); //setup current pattern from what we would have during execution function currentPatternClosure() { diff --git a/test/pattern_assembler_tests.js b/test/pattern_assembler_tests.js index 5ba989a11..d1704895a 100644 --- a/test/pattern_assembler_tests.js +++ b/test/pattern_assembler_tests.js @@ -1,8 +1,8 @@ (function () { "use strict"; - var pa = require('../builder/pattern_assembler'); - var object_factory = require('../builder/object_factory'); + var pa = require('../core/lib/pattern_assembler'); + var object_factory = require('../core/lib/object_factory'); var path = require('path'); exports['pattern_assembler'] = { @@ -193,7 +193,7 @@ //prepare to diveSync var diveSync = require('diveSync'); var fs = require('fs-extra'); - var pa = require('../builder/pattern_assembler'); + var pa = require('../core/lib/pattern_assembler'); var pattern_assembler = new pa(); var patterns_dir = './test/files/_patterns'; var patternlab = {}; @@ -520,7 +520,7 @@ //arrange var diveSync = require('diveSync'); var fs = require('fs-extra'); - var pa = require('../builder/pattern_assembler'); + var pa = require('../core/lib/pattern_assembler'); var pattern_assembler = new pa(); var patterns_dir = './test/files/_patterns'; var patternlab = {}; @@ -571,7 +571,7 @@ }, 'setState - applies any patternState matching the pattern' : function(test){ //arrange - var pa = require('../builder/pattern_assembler'); + var pa = require('../core/lib/pattern_assembler'); var pattern_assembler = new pa(); var patternlab = {}; patternlab.config = {}; @@ -591,7 +591,7 @@ }, 'setState - does not apply any patternState if nothing matches the pattern' : function(test){ //arrange - var pa = require('../builder/pattern_assembler'); + var pa = require('../core/lib/pattern_assembler'); var pattern_assembler = new pa(); var patternlab = {}; patternlab.config = {}; @@ -613,7 +613,7 @@ //arrange var diveSync = require('diveSync'); var fs = require('fs-extra'); - var pa = require('../builder/pattern_assembler'); + var pa = require('../core/lib/pattern_assembler'); var pattern_assembler = new pa(); var patterns_dir = './test/files/_patterns/'; var patternlab = {}; diff --git a/test/pseudopattern_hunter_tests.js b/test/pseudopattern_hunter_tests.js index 9a0269482..3a97b773f 100644 --- a/test/pseudopattern_hunter_tests.js +++ b/test/pseudopattern_hunter_tests.js @@ -1,9 +1,9 @@ (function () { "use strict"; - var pha = require('../builder/pseudopattern_hunter'); - var pa = require('../builder/pattern_assembler'); - var object_factory = require('../builder/object_factory'); + var pha = require('../core/lib/pseudopattern_hunter'); + var pa = require('../core/lib/pattern_assembler'); + var object_factory = require('../core/lib/object_factory'); exports['pseudopattern_hunter'] = { 'pseudpattern found and added as a pattern' : function(test){ diff --git a/test/style_modifier_hunter_tests.js b/test/style_modifier_hunter_tests.js index 9a13a75e4..7a3562ad0 100644 --- a/test/style_modifier_hunter_tests.js +++ b/test/style_modifier_hunter_tests.js @@ -1,7 +1,7 @@ (function () { "use strict"; - var smh = require('../builder/style_modifier_hunter'); + var smh = require('../core/lib/style_modifier_hunter'); exports['consume_style_modifier'] = { 'uses the partial stylemodifer to modify the patterns extendedTemplate' : function(test){ From b5622afe7b1968eda32cc2b0ae225a23f4daad23 Mon Sep 17 00:00:00 2001 From: BRIAN MUENZENMEYER Date: Wed, 2 Mar 2016 10:06:59 -0600 Subject: [PATCH 2/5] move source/_patternlab-files/partials to core/templates move source/_patternlab-files/pattern-header-footer to core/source/_meta updated config entries #133 --- config.json | 2 +- core/lib/patternlab.js | 20 +++--- .../README => core/source/_meta/README.txt | 0 .../source/_meta}/footer.html | 0 .../source/_meta}/header.html | 0 .../README => core/templates/README.txt | 0 .../templates}/index.mustache | 0 core/templates/partials/ishControls.mustache | 64 +++++++++++++++++++ core/templates/partials/patternNav.mustache | 17 +++++ core/templates/partials/patternPaths.mustache | 3 + core/templates/partials/viewAllPaths.mustache | 3 + .../templates}/styleguide.mustache | 0 .../templates}/viewall.mustache | 0 test/pattern_assembler_tests.js | 12 ++-- 14 files changed, 104 insertions(+), 17 deletions(-) rename source/_patternlab-files/pattern-header-footer/README => core/source/_meta/README.txt (100%) rename {source/_patternlab-files/pattern-header-footer => core/source/_meta}/footer.html (100%) rename {source/_patternlab-files/pattern-header-footer => core/source/_meta}/header.html (100%) rename source/_patternlab-files/README => core/templates/README.txt (100%) rename {source/_patternlab-files => core/templates}/index.mustache (100%) create mode 100644 core/templates/partials/ishControls.mustache create mode 100644 core/templates/partials/patternNav.mustache create mode 100644 core/templates/partials/patternPaths.mustache create mode 100644 core/templates/partials/viewAllPaths.mustache rename {source/_patternlab-files => core/templates}/styleguide.mustache (100%) rename {source/_patternlab-files => core/templates}/viewall.mustache (100%) diff --git a/config.json b/config.json index 187e8955d..d9aec61cb 100644 --- a/config.json +++ b/config.json @@ -5,7 +5,7 @@ "patterns" : "./source/_patterns/", "data" : "./source/_data/", "styleguide" : "./core/styleguide/", - "patternlabFiles" : "./source/_patternlab-files/", + "patternlabFiles" : "./core/", "js" : "./source/js", "images" : "./source/images", "fonts" : "./source/fonts", diff --git a/core/lib/patternlab.js b/core/lib/patternlab.js index 128d95009..f4fb81a06 100644 --- a/core/lib/patternlab.js +++ b/core/lib/patternlab.js @@ -57,8 +57,8 @@ var patternlab_engine = function (config) { function buildPatterns(deletePatternDir) { patternlab.data = fs.readJSONSync(path.resolve(paths.source.data, 'data.json')); patternlab.listitems = fs.readJSONSync(path.resolve(paths.source.data, 'listitems.json')); - patternlab.header = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'pattern-header-footer/header.html'), 'utf8'); - patternlab.footer = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'pattern-header-footer/footer.html'), 'utf8'); + patternlab.header = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'source/_meta/header.html'), 'utf8'); + patternlab.footer = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'source/_meta/footer.html'), 'utf8'); patternlab.patterns = []; patternlab.partials = {}; patternlab.data.link = {}; @@ -212,7 +212,7 @@ var patternlab_engine = function (config) { } //build the styleguide - var styleguideTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'styleguide.mustache'), 'utf8'), + var styleguideTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/styleguide.mustache'), 'utf8'), styleguideHtml = pattern_assembler.renderPattern(styleguideTemplate, {partials: styleguidePatterns}); fs.outputFileSync(path.resolve(paths.public.styleguide, 'html/styleguide.html'), styleguideHtml); @@ -255,7 +255,7 @@ var patternlab_engine = function (config) { } } - var viewAllTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'viewall.mustache'), 'utf8'); + var viewAllTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/viewall.mustache'), 'utf8'); var viewAllHtml = pattern_assembler.renderPattern(viewAllTemplate, {partials: viewAllPatterns, patternPartial: patternPartial}); fs.outputFileSync(paths.public.patterns + pattern.subdir.slice(0, pattern.subdir.indexOf(pattern.patternGroup) + pattern.patternGroup.length) + '/index.html', viewAllHtml); } @@ -282,14 +282,14 @@ var patternlab_engine = function (config) { } } - var viewAllTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'viewall.mustache'), 'utf8'); + var viewAllTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/viewall.mustache'), 'utf8'); var viewAllHtml = pattern_assembler.renderPattern(viewAllTemplate, {partials: viewAllPatterns, patternPartial: patternPartial}); fs.outputFileSync(paths.public.patterns + pattern.flatPatternPath + '/index.html', viewAllHtml); } } //build the patternlab website - var patternlabSiteTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'index.mustache'), 'utf8'); + var patternlabSiteTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/index.mustache'), 'utf8'); //loop through all patterns.to build the navigation //todo: refactor this someday @@ -462,20 +462,20 @@ var patternlab_engine = function (config) { //the patternlab site requires a lot of partials to be rendered. //patternNav - var patternNavTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'partials/patternNav.mustache'), 'utf8'); + var patternNavTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/partials/patternNav.mustache'), 'utf8'); var patternNavPartialHtml = pattern_assembler.renderPattern(patternNavTemplate, patternlab); //ishControls - var ishControlsTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'partials/ishControls.mustache'), 'utf8'); + var ishControlsTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/partials/ishControls.mustache'), 'utf8'); patternlab.config.mqs = patternlab.mediaQueries; var ishControlsPartialHtml = pattern_assembler.renderPattern(ishControlsTemplate, patternlab.config); //patternPaths - var patternPathsTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'partials/patternPaths.mustache'), 'utf8'); + var patternPathsTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/partials/patternPaths.mustache'), 'utf8'); var patternPathsPartialHtml = pattern_assembler.renderPattern(patternPathsTemplate, {'patternPaths': JSON.stringify(patternlab.patternPaths)}); //viewAllPaths - var viewAllPathsTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'partials/viewAllPaths.mustache'), 'utf8'); + var viewAllPathsTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/partials/viewAllPaths.mustache'), 'utf8'); var viewAllPathsPartialHtml = pattern_assembler.renderPattern(viewAllPathsTemplate, {'viewallpaths': JSON.stringify(patternlab.viewAllPaths)}); //render the patternlab template, with all partials diff --git a/source/_patternlab-files/pattern-header-footer/README b/core/source/_meta/README.txt similarity index 100% rename from source/_patternlab-files/pattern-header-footer/README rename to core/source/_meta/README.txt diff --git a/source/_patternlab-files/pattern-header-footer/footer.html b/core/source/_meta/footer.html similarity index 100% rename from source/_patternlab-files/pattern-header-footer/footer.html rename to core/source/_meta/footer.html diff --git a/source/_patternlab-files/pattern-header-footer/header.html b/core/source/_meta/header.html similarity index 100% rename from source/_patternlab-files/pattern-header-footer/header.html rename to core/source/_meta/header.html diff --git a/source/_patternlab-files/README b/core/templates/README.txt similarity index 100% rename from source/_patternlab-files/README rename to core/templates/README.txt diff --git a/source/_patternlab-files/index.mustache b/core/templates/index.mustache similarity index 100% rename from source/_patternlab-files/index.mustache rename to core/templates/index.mustache diff --git a/core/templates/partials/ishControls.mustache b/core/templates/partials/ishControls.mustache new file mode 100644 index 000000000..6c0a70b68 --- /dev/null +++ b/core/templates/partials/ishControls.mustache @@ -0,0 +1,64 @@ + +
+
+
    +
  • +
    +
    + Size px / + em +
    +
    +
      + {{# ishControlsVisible.s }}
    • S
    • {{/ ishControlsVisible.s }} + {{# ishControlsVisible.m }}
    • M
    • {{/ ishControlsVisible.m }} + {{# ishControlsVisible.l }}
    • L
    • {{/ ishControlsVisible.l }} + {{# ishControlsVisible.full }}
    • Full
    • {{/ ishControlsVisible.full }} + {{# ishControlsVisible.random }}
    • Random
    • {{/ ishControlsVisible.random }} + {{# ishControlsVisible.disco }}
    • Disco
    • {{/ ishControlsVisible.disco }} + {{# ishControlsVisible.hay }}
    • Hay!
    • {{/ ishControlsVisible.hay }} +
    +
  • + {{# ishControlsVisible.mqs }} +
  • + MQ +
      + {{# mqs }} +
    • {{ . }}
    • + {{/ mqs }} +
    +
  • + {{/ ishControlsVisible.mqs }} + {{# ishControlsVisible.find }} +
  • + Search Patterns +
      +
    • +
    +
  • + {{/ ishControlsVisible.find }} + {{# ishControlsVisible.views-all }} +
  • + View +
      + {{# ishControlsVisible.views-annotations }}
    • Annotations
    • {{/ ishControlsVisible.views-annotations }} + {{# ishControlsVisible.views-code }}
    • Code
    • {{/ ishControlsVisible.views-code }} + {{# ishControlsVisible.views-new }}
    • Open in new window
    • {{/ ishControlsVisible.views-new }} +
    +
  • + {{/ ishControlsVisible.views-all }} + {{# ishControlsVisible.tools-all }} +
  • + Tools +
      + {{# ishControlsVisible.tools-sync }}
    • BrowserSync UI
    • {{/ ishControlsVisible.tools-sync }} + {{# ishControlsVisible.tools-shortcuts }}
    • Keyboard Shortcuts{{/ ishControlsVisible.tools-shortcuts }} + {{# ishControlsVisible.tools-docs }}
    • Pattern Lab Docs{{/ ishControlsVisible.tools-docs }} +
    +
  • + {{/ ishControlsVisible.tools-all }} +
+ +
+
+ diff --git a/core/templates/partials/patternNav.mustache b/core/templates/partials/patternNav.mustache new file mode 100644 index 000000000..86933aa55 --- /dev/null +++ b/core/templates/partials/patternNav.mustache @@ -0,0 +1,17 @@ +
    + {{# buckets }} +
  1. {{ bucketNameUC }}
      + {{# navItems }} +
    1. {{ sectionNameUC }}
        + {{# navSubItems }} +
      1. {{ patternName }}
      2. + {{/ navSubItems }} +
    2. + {{/ navItems }} + {{# patternItems }} +
    3. {{ patternName }}
    4. + {{/ patternItems }} +
  2. + {{/ buckets }} +
  3. All
  4. +
diff --git a/core/templates/partials/patternPaths.mustache b/core/templates/partials/patternPaths.mustache new file mode 100644 index 000000000..798744030 --- /dev/null +++ b/core/templates/partials/patternPaths.mustache @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/core/templates/partials/viewAllPaths.mustache b/core/templates/partials/viewAllPaths.mustache new file mode 100644 index 000000000..b0e044d97 --- /dev/null +++ b/core/templates/partials/viewAllPaths.mustache @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/source/_patternlab-files/styleguide.mustache b/core/templates/styleguide.mustache similarity index 100% rename from source/_patternlab-files/styleguide.mustache rename to core/templates/styleguide.mustache diff --git a/source/_patternlab-files/viewall.mustache b/core/templates/viewall.mustache similarity index 100% rename from source/_patternlab-files/viewall.mustache rename to core/templates/viewall.mustache diff --git a/test/pattern_assembler_tests.js b/test/pattern_assembler_tests.js index d1704895a..f28ea7c1c 100644 --- a/test/pattern_assembler_tests.js +++ b/test/pattern_assembler_tests.js @@ -202,8 +202,8 @@ patternlab.data = fs.readJSONSync(path.resolve(patternlab.config.paths.source.data, 'data.json')); patternlab.listitems = fs.readJSONSync(path.resolve(patternlab.config.paths.source.data, 'listitems.json')); - patternlab.header = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'pattern-header-footer/header.html'), 'utf8'); - patternlab.footer = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'pattern-header-footer/footer.html'), 'utf8'); + patternlab.header = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'source/_meta/header.html'), 'utf8'); + patternlab.footer = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'source/_meta/footer.html'), 'utf8'); patternlab.patterns = []; patternlab.data.link = {}; patternlab.partials = {}; @@ -530,8 +530,8 @@ patternlab.data = fs.readJSONSync(path.resolve(patternlab.config.paths.source.data, 'data.json')); patternlab.listitems = fs.readJSONSync(path.resolve(patternlab.config.paths.source.data, 'listitems.json')); - patternlab.header = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'pattern-header-footer/header.html'), 'utf8'); - patternlab.footer = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'pattern-header-footer/footer.html'), 'utf8'); + patternlab.header = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'source/_meta/header.html'), 'utf8'); + patternlab.footer = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'source/_meta/footer.html'), 'utf8'); patternlab.patterns = []; patternlab.data.link = {}; patternlab.partials = {}; @@ -622,8 +622,8 @@ patternlab.config.paths.source.patterns = patterns_dir; patternlab.data = fs.readJSONSync(path.resolve(patternlab.config.paths.source.data, 'data.json')); patternlab.listitems = fs.readJSONSync(path.resolve(patternlab.config.paths.source.data, 'listitems.json')); - patternlab.header = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'pattern-header-footer/header.html'), 'utf8'); - patternlab.footer = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'pattern-header-footer/footer.html'), 'utf8'); + patternlab.header = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'source/_meta/header.html'), 'utf8'); + patternlab.footer = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'source/_meta/footer.html'), 'utf8'); patternlab.patterns = []; patternlab.data.link = {}; patternlab.partials = {}; From 05a922c69a8c4f43fab8ad02cc88a836f70cf182 Mon Sep 17 00:00:00 2001 From: BRIAN MUENZENMEYER Date: Fri, 4 Mar 2016 00:10:39 -0600 Subject: [PATCH 3/5] #133 add user defined atoms-_head and atoms-_foot pattern move patterns to account for new dir move footer and header to proper place inject header and footer into styleguide, index, and pattern html --- core/lib/patternlab.js | 61 +++++++++++++++--- core/source/_meta/footer.html | 34 ---------- core/source/_meta/header.html | 35 ---------- core/templates/index.mustache | 12 +++- .../pattern-header-footer}/README.txt | 0 .../pattern-header-footer/footer-pattern.html | 19 ++++++ .../pattern-header-footer/footer.html | 6 ++ .../pattern-header-footer/header.html | 9 +++ core/templates/styleguide.mustache | 20 ------ core/templates/viewall.mustache | 19 ------ .../partials/ishControls.mustache | 64 ------------------- .../partials/patternNav.mustache | 17 ----- .../partials/patternPaths.mustache | 3 - .../partials/viewAllPaths.mustache | 3 - .../00-atoms/00-meta/_00-head.mustache | 15 +++++ .../00-atoms/00-meta/_01-foot.mustache | 7 ++ .../00-colors.mustache | 0 .../01-fonts.mustache | 0 .../02-animations.mustache | 0 .../03-visibility.mustache | 0 .../{01-text => 02-text}/00-headings.mustache | 0 .../01-subheadings.mustache | 0 .../02-headings-with-links.mustache | 0 .../03-paragraph.mustache | 0 .../04-blockquote.mustache | 0 .../05-inline-elements.mustache | 0 .../{01-text => 02-text}/06-time.mustache | 0 .../07-preformatted-text.mustache | 0 .../08-emphasis-colors.mustache | 0 .../{01-text => 02-text}/09-hr.mustache | 0 .../{01-text => 02-text}/10-caption.mustache | 0 .../00-unordered.mustache | 0 .../01-ordered.mustache | 0 .../02-definition.mustache | 0 .../{03-images => 04-images}/00-logo.mustache | 0 .../01-landscape-4x3.mustache | 0 .../02-landscape-16x9.mustache | 0 .../03-square.mustache | 0 .../04-avatar.mustache | 0 .../05-icons.mustache | 0 .../06-loading-icon.mustache | 0 .../07-favicon.mustache | 0 .../00-text-fields.mustache | 0 .../01-select-menu.mustache | 0 .../02-checkbox.mustache | 0 .../03-radio-buttons.mustache | 0 .../04-html5-inputs.mustache | 0 .../00-buttons.mustache | 0 .../00-table.mustache | 0 .../{07-media => 08-media}/00-video.mustache | 0 .../{07-media => 08-media}/01-audio.mustache | 0 test/pattern_assembler_tests.js | 12 ++-- 52 files changed, 125 insertions(+), 211 deletions(-) delete mode 100644 core/source/_meta/footer.html delete mode 100644 core/source/_meta/header.html rename core/{source/_meta => templates/pattern-header-footer}/README.txt (100%) create mode 100644 core/templates/pattern-header-footer/footer-pattern.html create mode 100644 core/templates/pattern-header-footer/footer.html create mode 100644 core/templates/pattern-header-footer/header.html delete mode 100644 source/_patternlab-files/partials/ishControls.mustache delete mode 100644 source/_patternlab-files/partials/patternNav.mustache delete mode 100644 source/_patternlab-files/partials/patternPaths.mustache delete mode 100644 source/_patternlab-files/partials/viewAllPaths.mustache create mode 100644 source/_patterns/00-atoms/00-meta/_00-head.mustache create mode 100644 source/_patterns/00-atoms/00-meta/_01-foot.mustache rename source/_patterns/00-atoms/{00-global => 01-global}/00-colors.mustache (100%) rename source/_patterns/00-atoms/{00-global => 01-global}/01-fonts.mustache (100%) rename source/_patterns/00-atoms/{00-global => 01-global}/02-animations.mustache (100%) rename source/_patterns/00-atoms/{00-global => 01-global}/03-visibility.mustache (100%) rename source/_patterns/00-atoms/{01-text => 02-text}/00-headings.mustache (100%) rename source/_patterns/00-atoms/{01-text => 02-text}/01-subheadings.mustache (100%) rename source/_patterns/00-atoms/{01-text => 02-text}/02-headings-with-links.mustache (100%) rename source/_patterns/00-atoms/{01-text => 02-text}/03-paragraph.mustache (100%) rename source/_patterns/00-atoms/{01-text => 02-text}/04-blockquote.mustache (100%) rename source/_patterns/00-atoms/{01-text => 02-text}/05-inline-elements.mustache (100%) rename source/_patterns/00-atoms/{01-text => 02-text}/06-time.mustache (100%) rename source/_patterns/00-atoms/{01-text => 02-text}/07-preformatted-text.mustache (100%) rename source/_patterns/00-atoms/{01-text => 02-text}/08-emphasis-colors.mustache (100%) rename source/_patterns/00-atoms/{01-text => 02-text}/09-hr.mustache (100%) rename source/_patterns/00-atoms/{01-text => 02-text}/10-caption.mustache (100%) rename source/_patterns/00-atoms/{02-lists => 03-lists}/00-unordered.mustache (100%) rename source/_patterns/00-atoms/{02-lists => 03-lists}/01-ordered.mustache (100%) rename source/_patterns/00-atoms/{02-lists => 03-lists}/02-definition.mustache (100%) rename source/_patterns/00-atoms/{03-images => 04-images}/00-logo.mustache (100%) rename source/_patterns/00-atoms/{03-images => 04-images}/01-landscape-4x3.mustache (100%) rename source/_patterns/00-atoms/{03-images => 04-images}/02-landscape-16x9.mustache (100%) rename source/_patterns/00-atoms/{03-images => 04-images}/03-square.mustache (100%) rename source/_patterns/00-atoms/{03-images => 04-images}/04-avatar.mustache (100%) rename source/_patterns/00-atoms/{03-images => 04-images}/05-icons.mustache (100%) rename source/_patterns/00-atoms/{03-images => 04-images}/06-loading-icon.mustache (100%) rename source/_patterns/00-atoms/{03-images => 04-images}/07-favicon.mustache (100%) rename source/_patterns/00-atoms/{04-forms => 05-forms}/00-text-fields.mustache (100%) rename source/_patterns/00-atoms/{04-forms => 05-forms}/01-select-menu.mustache (100%) rename source/_patterns/00-atoms/{04-forms => 05-forms}/02-checkbox.mustache (100%) rename source/_patterns/00-atoms/{04-forms => 05-forms}/03-radio-buttons.mustache (100%) rename source/_patterns/00-atoms/{04-forms => 05-forms}/04-html5-inputs.mustache (100%) rename source/_patterns/00-atoms/{05-buttons => 06-buttons}/00-buttons.mustache (100%) rename source/_patterns/00-atoms/{06-tables => 07-tables}/00-table.mustache (100%) rename source/_patterns/00-atoms/{07-media => 08-media}/00-video.mustache (100%) rename source/_patterns/00-atoms/{07-media => 08-media}/01-audio.mustache (100%) diff --git a/core/lib/patternlab.js b/core/lib/patternlab.js index f4fb81a06..dc11e4ecd 100644 --- a/core/lib/patternlab.js +++ b/core/lib/patternlab.js @@ -57,8 +57,9 @@ var patternlab_engine = function (config) { function buildPatterns(deletePatternDir) { patternlab.data = fs.readJSONSync(path.resolve(paths.source.data, 'data.json')); patternlab.listitems = fs.readJSONSync(path.resolve(paths.source.data, 'listitems.json')); - patternlab.header = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'source/_meta/header.html'), 'utf8'); - patternlab.footer = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'source/_meta/footer.html'), 'utf8'); + patternlab.header = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/pattern-header-footer/header.html'), 'utf8'); + patternlab.footerPattern = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/pattern-header-footer/footer-pattern.html'), 'utf8'); + patternlab.footer = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/pattern-header-footer/footer.html'), 'utf8'); patternlab.patterns = []; patternlab.partials = {}; patternlab.data.link = {}; @@ -116,6 +117,25 @@ var patternlab_engine = function (config) { pattern_assembler.process_pattern_recursive(path.resolve(file), patternlab); }); + //set user defined head and foot if they exist + try { + patternlab.userHead = pattern_assembler.get_pattern_by_key('atoms-head', patternlab); + } + catch(ex) { + if (patternlab.config.debug) { + console.log(ex); + console.log('Could not find optional user-defined header, atoms-head pattern. It was likely deleted.'); + } + } + try { + patternlab.userFoot = pattern_assembler.get_pattern_by_key('atoms-foot', patternlab); + } + catch(ex) { + if (patternlab.config.debug) { + console.log(ex); + console.log('Could not find optional user-defined footer, atoms-foot pattern. It was likely deleted.'); + } + } //now that all the main patterns are known, look for any links that might be within data and expand them //we need to do this before expanding patterns & partials into extendedTemplates, otherwise we could lose the data -> partial reference @@ -126,21 +146,40 @@ var patternlab_engine = function (config) { fs.emptyDirSync(paths.public.patterns); } + //set pattern-specific header if necessary + var head; + if (patternlab.userHead) { + head = patternlab.userHead.extendedTemplate.replace('{% pattern-lab-head %}', patternlab.header); + } else { + head = patternlab.header; + } + //render all patterns last, so lineageR works patternlab.patterns.forEach(function (pattern) { + pattern.header = head; + //render the pattern, but first consolidate any data we may have var allData = JSON.parse(JSON.stringify(patternlab.data)); allData = pattern_assembler.merge_data(allData, pattern.jsonFileData); + //render the pattern-specific header + var headHtml = pattern_assembler.renderPattern(pattern.header, allData); + //render the extendedTemplate with all data pattern.patternPartial = pattern_assembler.renderPattern(pattern.extendedTemplate, allData); - //add footer info before writing - var patternFooter = pattern_assembler.renderPattern(patternlab.footer, pattern); + //set the pattern-specific footer if necessary + if (patternlab.userFoot) { + console.log('found custom userFoot') + var userFooter = patternlab.userFoot.extendedTemplate.replace('{% pattern-lab-foot %}', patternlab.footerPattern + patternlab.footer); + pattern.footer = pattern_assembler.renderPattern(userFooter, pattern); + } else { + pattern.footer = pattern_assembler.renderPattern(patternlab.footerPattern, pattern); + } //write the compiled template to the public patterns directory - fs.outputFileSync(paths.public.patterns + pattern.patternLink, patternlab.header + pattern.patternPartial + patternFooter); + fs.outputFileSync(paths.public.patterns + pattern.patternLink, headHtml + pattern.patternPartial + pattern.footer); //write the mustache file too fs.outputFileSync(paths.public.patterns + pattern.patternLink.replace('.html', '.mustache'), entity_encoder.encode(pattern.template)); @@ -211,11 +250,17 @@ var patternlab_engine = function (config) { styleguidePatterns = patternlab.patterns; } + //get the main page head and foot + var mainPageHead = patternlab.userHead.extendedTemplate.replace('{% pattern-lab-head %}', patternlab.header); + var mainPageHeadHtml = pattern_assembler.renderPattern(mainPageHead, patternlab.data); + var mainPageFoot = patternlab.userFoot.extendedTemplate.replace('{% pattern-lab-foot %}', patternlab.footer); + var mainPageFootHtml = pattern_assembler.renderPattern(mainPageFoot, patternlab.data); + //build the styleguide var styleguideTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/styleguide.mustache'), 'utf8'), styleguideHtml = pattern_assembler.renderPattern(styleguideTemplate, {partials: styleguidePatterns}); - fs.outputFileSync(path.resolve(paths.public.styleguide, 'html/styleguide.html'), styleguideHtml); + fs.outputFileSync(path.resolve(paths.public.styleguide, 'html/styleguide.html'), mainPageHeadHtml + styleguideHtml + mainPageFootHtml); //build the viewall pages var prevSubdir = '', @@ -257,7 +302,7 @@ var patternlab_engine = function (config) { var viewAllTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/viewall.mustache'), 'utf8'); var viewAllHtml = pattern_assembler.renderPattern(viewAllTemplate, {partials: viewAllPatterns, patternPartial: patternPartial}); - fs.outputFileSync(paths.public.patterns + pattern.subdir.slice(0, pattern.subdir.indexOf(pattern.patternGroup) + pattern.patternGroup.length) + '/index.html', viewAllHtml); + fs.outputFileSync(paths.public.patterns + pattern.subdir.slice(0, pattern.subdir.indexOf(pattern.patternGroup) + pattern.patternGroup.length) + '/index.html', mainPageHead + viewAllHtml + mainPageFoot); } // create the view all for the subsection @@ -284,7 +329,7 @@ var patternlab_engine = function (config) { var viewAllTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/viewall.mustache'), 'utf8'); var viewAllHtml = pattern_assembler.renderPattern(viewAllTemplate, {partials: viewAllPatterns, patternPartial: patternPartial}); - fs.outputFileSync(paths.public.patterns + pattern.flatPatternPath + '/index.html', viewAllHtml); + fs.outputFileSync(paths.public.patterns + pattern.flatPatternPath + '/index.html', mainPageHeadHtml + viewAllHtml + mainPageFootHtml); } } diff --git a/core/source/_meta/footer.html b/core/source/_meta/footer.html deleted file mode 100644 index 2234cfd9f..000000000 --- a/core/source/_meta/footer.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/source/_meta/header.html b/core/source/_meta/header.html deleted file mode 100644 index 1d0019a03..000000000 --- a/core/source/_meta/header.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - Pattern Lab Pattern - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/templates/index.mustache b/core/templates/index.mustache index 1688121dd..912839552 100644 --- a/core/templates/index.mustache +++ b/core/templates/index.mustache @@ -3,6 +3,14 @@ Pattern Lab + + + + + + + + @@ -21,7 +29,7 @@ - +
@@ -91,4 +99,4 @@ - \ No newline at end of file + diff --git a/core/source/_meta/README.txt b/core/templates/pattern-header-footer/README.txt similarity index 100% rename from core/source/_meta/README.txt rename to core/templates/pattern-header-footer/README.txt diff --git a/core/templates/pattern-header-footer/footer-pattern.html b/core/templates/pattern-header-footer/footer-pattern.html new file mode 100644 index 000000000..20caf0102 --- /dev/null +++ b/core/templates/pattern-header-footer/footer-pattern.html @@ -0,0 +1,19 @@ + + + + + + + diff --git a/core/templates/pattern-header-footer/footer.html b/core/templates/pattern-header-footer/footer.html new file mode 100644 index 000000000..9bdd04a87 --- /dev/null +++ b/core/templates/pattern-header-footer/footer.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/core/templates/pattern-header-footer/header.html b/core/templates/pattern-header-footer/header.html new file mode 100644 index 000000000..603079c27 --- /dev/null +++ b/core/templates/pattern-header-footer/header.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/core/templates/styleguide.mustache b/core/templates/styleguide.mustache index fe39a3816..b9a63debe 100644 --- a/core/templates/styleguide.mustache +++ b/core/templates/styleguide.mustache @@ -1,15 +1,3 @@ - - - - Pattern Lab Style Guide - - - - - - - -
@@ -58,11 +46,3 @@ var lineage = ""; var baseurl = "{{{baseurl}}}"; - - - - - - - - diff --git a/core/templates/viewall.mustache b/core/templates/viewall.mustache index 87b345ae2..e22a33833 100644 --- a/core/templates/viewall.mustache +++ b/core/templates/viewall.mustache @@ -1,14 +1,3 @@ - - - - Pattern Lab Sub-type Style Guide - - - - - - -
@@ -58,11 +47,3 @@ var lineage = ""; var baseurl = "{{{baseurl}}}"; - - - - - - - - diff --git a/source/_patternlab-files/partials/ishControls.mustache b/source/_patternlab-files/partials/ishControls.mustache deleted file mode 100644 index 6c0a70b68..000000000 --- a/source/_patternlab-files/partials/ishControls.mustache +++ /dev/null @@ -1,64 +0,0 @@ - -
-
-
    -
  • -
    -
    - Size px / - em -
    -
    -
      - {{# ishControlsVisible.s }}
    • S
    • {{/ ishControlsVisible.s }} - {{# ishControlsVisible.m }}
    • M
    • {{/ ishControlsVisible.m }} - {{# ishControlsVisible.l }}
    • L
    • {{/ ishControlsVisible.l }} - {{# ishControlsVisible.full }}
    • Full
    • {{/ ishControlsVisible.full }} - {{# ishControlsVisible.random }}
    • Random
    • {{/ ishControlsVisible.random }} - {{# ishControlsVisible.disco }}
    • Disco
    • {{/ ishControlsVisible.disco }} - {{# ishControlsVisible.hay }}
    • Hay!
    • {{/ ishControlsVisible.hay }} -
    -
  • - {{# ishControlsVisible.mqs }} -
  • - MQ -
      - {{# mqs }} -
    • {{ . }}
    • - {{/ mqs }} -
    -
  • - {{/ ishControlsVisible.mqs }} - {{# ishControlsVisible.find }} -
  • - Search Patterns -
      -
    • -
    -
  • - {{/ ishControlsVisible.find }} - {{# ishControlsVisible.views-all }} -
  • - View -
      - {{# ishControlsVisible.views-annotations }}
    • Annotations
    • {{/ ishControlsVisible.views-annotations }} - {{# ishControlsVisible.views-code }}
    • Code
    • {{/ ishControlsVisible.views-code }} - {{# ishControlsVisible.views-new }}
    • Open in new window
    • {{/ ishControlsVisible.views-new }} -
    -
  • - {{/ ishControlsVisible.views-all }} - {{# ishControlsVisible.tools-all }} -
  • - Tools -
      - {{# ishControlsVisible.tools-sync }}
    • BrowserSync UI
    • {{/ ishControlsVisible.tools-sync }} - {{# ishControlsVisible.tools-shortcuts }}
    • Keyboard Shortcuts{{/ ishControlsVisible.tools-shortcuts }} - {{# ishControlsVisible.tools-docs }}
    • Pattern Lab Docs{{/ ishControlsVisible.tools-docs }} -
    -
  • - {{/ ishControlsVisible.tools-all }} -
- -
-
- diff --git a/source/_patternlab-files/partials/patternNav.mustache b/source/_patternlab-files/partials/patternNav.mustache deleted file mode 100644 index 86933aa55..000000000 --- a/source/_patternlab-files/partials/patternNav.mustache +++ /dev/null @@ -1,17 +0,0 @@ -
    - {{# buckets }} -
  1. {{ bucketNameUC }}
      - {{# navItems }} -
    1. {{ sectionNameUC }}
        - {{# navSubItems }} -
      1. {{ patternName }}
      2. - {{/ navSubItems }} -
    2. - {{/ navItems }} - {{# patternItems }} -
    3. {{ patternName }}
    4. - {{/ patternItems }} -
  2. - {{/ buckets }} -
  3. All
  4. -
diff --git a/source/_patternlab-files/partials/patternPaths.mustache b/source/_patternlab-files/partials/patternPaths.mustache deleted file mode 100644 index 798744030..000000000 --- a/source/_patternlab-files/partials/patternPaths.mustache +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/source/_patternlab-files/partials/viewAllPaths.mustache b/source/_patternlab-files/partials/viewAllPaths.mustache deleted file mode 100644 index b0e044d97..000000000 --- a/source/_patternlab-files/partials/viewAllPaths.mustache +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/source/_patterns/00-atoms/00-meta/_00-head.mustache b/source/_patterns/00-atoms/00-meta/_00-head.mustache new file mode 100644 index 000000000..a751d06a2 --- /dev/null +++ b/source/_patterns/00-atoms/00-meta/_00-head.mustache @@ -0,0 +1,15 @@ + + + + {{ title }} + + + + + + + {% pattern-lab-head %} + + + + diff --git a/source/_patterns/00-atoms/00-meta/_01-foot.mustache b/source/_patterns/00-atoms/00-meta/_01-foot.mustache new file mode 100644 index 000000000..10e69fba6 --- /dev/null +++ b/source/_patterns/00-atoms/00-meta/_01-foot.mustache @@ -0,0 +1,7 @@ + + +{% pattern-lab-foot %} + + + + diff --git a/source/_patterns/00-atoms/00-global/00-colors.mustache b/source/_patterns/00-atoms/01-global/00-colors.mustache similarity index 100% rename from source/_patterns/00-atoms/00-global/00-colors.mustache rename to source/_patterns/00-atoms/01-global/00-colors.mustache diff --git a/source/_patterns/00-atoms/00-global/01-fonts.mustache b/source/_patterns/00-atoms/01-global/01-fonts.mustache similarity index 100% rename from source/_patterns/00-atoms/00-global/01-fonts.mustache rename to source/_patterns/00-atoms/01-global/01-fonts.mustache diff --git a/source/_patterns/00-atoms/00-global/02-animations.mustache b/source/_patterns/00-atoms/01-global/02-animations.mustache similarity index 100% rename from source/_patterns/00-atoms/00-global/02-animations.mustache rename to source/_patterns/00-atoms/01-global/02-animations.mustache diff --git a/source/_patterns/00-atoms/00-global/03-visibility.mustache b/source/_patterns/00-atoms/01-global/03-visibility.mustache similarity index 100% rename from source/_patterns/00-atoms/00-global/03-visibility.mustache rename to source/_patterns/00-atoms/01-global/03-visibility.mustache diff --git a/source/_patterns/00-atoms/01-text/00-headings.mustache b/source/_patterns/00-atoms/02-text/00-headings.mustache similarity index 100% rename from source/_patterns/00-atoms/01-text/00-headings.mustache rename to source/_patterns/00-atoms/02-text/00-headings.mustache diff --git a/source/_patterns/00-atoms/01-text/01-subheadings.mustache b/source/_patterns/00-atoms/02-text/01-subheadings.mustache similarity index 100% rename from source/_patterns/00-atoms/01-text/01-subheadings.mustache rename to source/_patterns/00-atoms/02-text/01-subheadings.mustache diff --git a/source/_patterns/00-atoms/01-text/02-headings-with-links.mustache b/source/_patterns/00-atoms/02-text/02-headings-with-links.mustache similarity index 100% rename from source/_patterns/00-atoms/01-text/02-headings-with-links.mustache rename to source/_patterns/00-atoms/02-text/02-headings-with-links.mustache diff --git a/source/_patterns/00-atoms/01-text/03-paragraph.mustache b/source/_patterns/00-atoms/02-text/03-paragraph.mustache similarity index 100% rename from source/_patterns/00-atoms/01-text/03-paragraph.mustache rename to source/_patterns/00-atoms/02-text/03-paragraph.mustache diff --git a/source/_patterns/00-atoms/01-text/04-blockquote.mustache b/source/_patterns/00-atoms/02-text/04-blockquote.mustache similarity index 100% rename from source/_patterns/00-atoms/01-text/04-blockquote.mustache rename to source/_patterns/00-atoms/02-text/04-blockquote.mustache diff --git a/source/_patterns/00-atoms/01-text/05-inline-elements.mustache b/source/_patterns/00-atoms/02-text/05-inline-elements.mustache similarity index 100% rename from source/_patterns/00-atoms/01-text/05-inline-elements.mustache rename to source/_patterns/00-atoms/02-text/05-inline-elements.mustache diff --git a/source/_patterns/00-atoms/01-text/06-time.mustache b/source/_patterns/00-atoms/02-text/06-time.mustache similarity index 100% rename from source/_patterns/00-atoms/01-text/06-time.mustache rename to source/_patterns/00-atoms/02-text/06-time.mustache diff --git a/source/_patterns/00-atoms/01-text/07-preformatted-text.mustache b/source/_patterns/00-atoms/02-text/07-preformatted-text.mustache similarity index 100% rename from source/_patterns/00-atoms/01-text/07-preformatted-text.mustache rename to source/_patterns/00-atoms/02-text/07-preformatted-text.mustache diff --git a/source/_patterns/00-atoms/01-text/08-emphasis-colors.mustache b/source/_patterns/00-atoms/02-text/08-emphasis-colors.mustache similarity index 100% rename from source/_patterns/00-atoms/01-text/08-emphasis-colors.mustache rename to source/_patterns/00-atoms/02-text/08-emphasis-colors.mustache diff --git a/source/_patterns/00-atoms/01-text/09-hr.mustache b/source/_patterns/00-atoms/02-text/09-hr.mustache similarity index 100% rename from source/_patterns/00-atoms/01-text/09-hr.mustache rename to source/_patterns/00-atoms/02-text/09-hr.mustache diff --git a/source/_patterns/00-atoms/01-text/10-caption.mustache b/source/_patterns/00-atoms/02-text/10-caption.mustache similarity index 100% rename from source/_patterns/00-atoms/01-text/10-caption.mustache rename to source/_patterns/00-atoms/02-text/10-caption.mustache diff --git a/source/_patterns/00-atoms/02-lists/00-unordered.mustache b/source/_patterns/00-atoms/03-lists/00-unordered.mustache similarity index 100% rename from source/_patterns/00-atoms/02-lists/00-unordered.mustache rename to source/_patterns/00-atoms/03-lists/00-unordered.mustache diff --git a/source/_patterns/00-atoms/02-lists/01-ordered.mustache b/source/_patterns/00-atoms/03-lists/01-ordered.mustache similarity index 100% rename from source/_patterns/00-atoms/02-lists/01-ordered.mustache rename to source/_patterns/00-atoms/03-lists/01-ordered.mustache diff --git a/source/_patterns/00-atoms/02-lists/02-definition.mustache b/source/_patterns/00-atoms/03-lists/02-definition.mustache similarity index 100% rename from source/_patterns/00-atoms/02-lists/02-definition.mustache rename to source/_patterns/00-atoms/03-lists/02-definition.mustache diff --git a/source/_patterns/00-atoms/03-images/00-logo.mustache b/source/_patterns/00-atoms/04-images/00-logo.mustache similarity index 100% rename from source/_patterns/00-atoms/03-images/00-logo.mustache rename to source/_patterns/00-atoms/04-images/00-logo.mustache diff --git a/source/_patterns/00-atoms/03-images/01-landscape-4x3.mustache b/source/_patterns/00-atoms/04-images/01-landscape-4x3.mustache similarity index 100% rename from source/_patterns/00-atoms/03-images/01-landscape-4x3.mustache rename to source/_patterns/00-atoms/04-images/01-landscape-4x3.mustache diff --git a/source/_patterns/00-atoms/03-images/02-landscape-16x9.mustache b/source/_patterns/00-atoms/04-images/02-landscape-16x9.mustache similarity index 100% rename from source/_patterns/00-atoms/03-images/02-landscape-16x9.mustache rename to source/_patterns/00-atoms/04-images/02-landscape-16x9.mustache diff --git a/source/_patterns/00-atoms/03-images/03-square.mustache b/source/_patterns/00-atoms/04-images/03-square.mustache similarity index 100% rename from source/_patterns/00-atoms/03-images/03-square.mustache rename to source/_patterns/00-atoms/04-images/03-square.mustache diff --git a/source/_patterns/00-atoms/03-images/04-avatar.mustache b/source/_patterns/00-atoms/04-images/04-avatar.mustache similarity index 100% rename from source/_patterns/00-atoms/03-images/04-avatar.mustache rename to source/_patterns/00-atoms/04-images/04-avatar.mustache diff --git a/source/_patterns/00-atoms/03-images/05-icons.mustache b/source/_patterns/00-atoms/04-images/05-icons.mustache similarity index 100% rename from source/_patterns/00-atoms/03-images/05-icons.mustache rename to source/_patterns/00-atoms/04-images/05-icons.mustache diff --git a/source/_patterns/00-atoms/03-images/06-loading-icon.mustache b/source/_patterns/00-atoms/04-images/06-loading-icon.mustache similarity index 100% rename from source/_patterns/00-atoms/03-images/06-loading-icon.mustache rename to source/_patterns/00-atoms/04-images/06-loading-icon.mustache diff --git a/source/_patterns/00-atoms/03-images/07-favicon.mustache b/source/_patterns/00-atoms/04-images/07-favicon.mustache similarity index 100% rename from source/_patterns/00-atoms/03-images/07-favicon.mustache rename to source/_patterns/00-atoms/04-images/07-favicon.mustache diff --git a/source/_patterns/00-atoms/04-forms/00-text-fields.mustache b/source/_patterns/00-atoms/05-forms/00-text-fields.mustache similarity index 100% rename from source/_patterns/00-atoms/04-forms/00-text-fields.mustache rename to source/_patterns/00-atoms/05-forms/00-text-fields.mustache diff --git a/source/_patterns/00-atoms/04-forms/01-select-menu.mustache b/source/_patterns/00-atoms/05-forms/01-select-menu.mustache similarity index 100% rename from source/_patterns/00-atoms/04-forms/01-select-menu.mustache rename to source/_patterns/00-atoms/05-forms/01-select-menu.mustache diff --git a/source/_patterns/00-atoms/04-forms/02-checkbox.mustache b/source/_patterns/00-atoms/05-forms/02-checkbox.mustache similarity index 100% rename from source/_patterns/00-atoms/04-forms/02-checkbox.mustache rename to source/_patterns/00-atoms/05-forms/02-checkbox.mustache diff --git a/source/_patterns/00-atoms/04-forms/03-radio-buttons.mustache b/source/_patterns/00-atoms/05-forms/03-radio-buttons.mustache similarity index 100% rename from source/_patterns/00-atoms/04-forms/03-radio-buttons.mustache rename to source/_patterns/00-atoms/05-forms/03-radio-buttons.mustache diff --git a/source/_patterns/00-atoms/04-forms/04-html5-inputs.mustache b/source/_patterns/00-atoms/05-forms/04-html5-inputs.mustache similarity index 100% rename from source/_patterns/00-atoms/04-forms/04-html5-inputs.mustache rename to source/_patterns/00-atoms/05-forms/04-html5-inputs.mustache diff --git a/source/_patterns/00-atoms/05-buttons/00-buttons.mustache b/source/_patterns/00-atoms/06-buttons/00-buttons.mustache similarity index 100% rename from source/_patterns/00-atoms/05-buttons/00-buttons.mustache rename to source/_patterns/00-atoms/06-buttons/00-buttons.mustache diff --git a/source/_patterns/00-atoms/06-tables/00-table.mustache b/source/_patterns/00-atoms/07-tables/00-table.mustache similarity index 100% rename from source/_patterns/00-atoms/06-tables/00-table.mustache rename to source/_patterns/00-atoms/07-tables/00-table.mustache diff --git a/source/_patterns/00-atoms/07-media/00-video.mustache b/source/_patterns/00-atoms/08-media/00-video.mustache similarity index 100% rename from source/_patterns/00-atoms/07-media/00-video.mustache rename to source/_patterns/00-atoms/08-media/00-video.mustache diff --git a/source/_patterns/00-atoms/07-media/01-audio.mustache b/source/_patterns/00-atoms/08-media/01-audio.mustache similarity index 100% rename from source/_patterns/00-atoms/07-media/01-audio.mustache rename to source/_patterns/00-atoms/08-media/01-audio.mustache diff --git a/test/pattern_assembler_tests.js b/test/pattern_assembler_tests.js index f28ea7c1c..cca671f9d 100644 --- a/test/pattern_assembler_tests.js +++ b/test/pattern_assembler_tests.js @@ -202,8 +202,8 @@ patternlab.data = fs.readJSONSync(path.resolve(patternlab.config.paths.source.data, 'data.json')); patternlab.listitems = fs.readJSONSync(path.resolve(patternlab.config.paths.source.data, 'listitems.json')); - patternlab.header = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'source/_meta/header.html'), 'utf8'); - patternlab.footer = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'source/_meta/footer.html'), 'utf8'); + patternlab.header = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'templates/pattern-header-footer/header.html'), 'utf8'); + patternlab.footer = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'templates/pattern-header-footer/footer.html'), 'utf8'); patternlab.patterns = []; patternlab.data.link = {}; patternlab.partials = {}; @@ -530,8 +530,8 @@ patternlab.data = fs.readJSONSync(path.resolve(patternlab.config.paths.source.data, 'data.json')); patternlab.listitems = fs.readJSONSync(path.resolve(patternlab.config.paths.source.data, 'listitems.json')); - patternlab.header = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'source/_meta/header.html'), 'utf8'); - patternlab.footer = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'source/_meta/footer.html'), 'utf8'); + patternlab.header = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'templates/pattern-header-footer/header.html'), 'utf8'); + patternlab.footer = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'templates/pattern-header-footer/footer.html'), 'utf8'); patternlab.patterns = []; patternlab.data.link = {}; patternlab.partials = {}; @@ -622,8 +622,8 @@ patternlab.config.paths.source.patterns = patterns_dir; patternlab.data = fs.readJSONSync(path.resolve(patternlab.config.paths.source.data, 'data.json')); patternlab.listitems = fs.readJSONSync(path.resolve(patternlab.config.paths.source.data, 'listitems.json')); - patternlab.header = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'source/_meta/header.html'), 'utf8'); - patternlab.footer = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'source/_meta/footer.html'), 'utf8'); + patternlab.header = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'templates/pattern-header-footer/header.html'), 'utf8'); + patternlab.footer = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'templates/pattern-header-footer/footer.html'), 'utf8'); patternlab.patterns = []; patternlab.data.link = {}; patternlab.partials = {}; From db06056fdd9ceb84629c987e6c8ffea8a3cff7ca Mon Sep 17 00:00:00 2001 From: BRIAN MUENZENMEYER Date: Sat, 5 Mar 2016 14:57:58 -0600 Subject: [PATCH 4/5] remove a debug statement --- core/lib/patternlab.js | 1 - 1 file changed, 1 deletion(-) diff --git a/core/lib/patternlab.js b/core/lib/patternlab.js index dc11e4ecd..91d155f58 100644 --- a/core/lib/patternlab.js +++ b/core/lib/patternlab.js @@ -171,7 +171,6 @@ var patternlab_engine = function (config) { //set the pattern-specific footer if necessary if (patternlab.userFoot) { - console.log('found custom userFoot') var userFooter = patternlab.userFoot.extendedTemplate.replace('{% pattern-lab-foot %}', patternlab.footerPattern + patternlab.footer); pattern.footer = pattern_assembler.renderPattern(userFooter, pattern); } else { From d167a97b694d73987a2de43f58f07fcfb2a38b58 Mon Sep 17 00:00:00 2001 From: BRIAN MUENZENMEYER Date: Sun, 6 Mar 2016 22:12:39 -0600 Subject: [PATCH 5/5] cacheBust support --- README.md | 10 +++++++ config.json | 3 +- core/lib/patternlab.js | 28 ++++++++++++++++--- core/templates/index.mustache | 26 ++++++++--------- .../pattern-header-footer/footer.html | 10 +++---- .../pattern-header-footer/header.html | 4 +-- 6 files changed, 56 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index c934f0738..22df180af 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,16 @@ Pattern states should be lowercase and use hyphens where spaces are present. Coupled with exported css (much easier to extract with existing tools like [grunt-contrib-copy](https://github.com/gruntjs/grunt-contrib-copy)), pattern export can help to maintain the relevancy of the design system by directly placing partials in a directory of your choosing. +##### cacheBust +`config.json` has this flag to instruct Pattern Lab to append a unique query string to Javascript and CSS assets throughout the frontend. + +``` +"cacheBust": true +``` + +Default: true + + ##### baseurl If your instance of Pattern Lab lives in a subdirectory of your server, for instance on github pages (ex: yourusername.github.io/patterns-demo/), then add the baseurl here. The baseurl is everything after the hostname - ie: `patterns-demo` diff --git a/config.json b/config.json index d9aec61cb..4d42d0bc5 100644 --- a/config.json +++ b/config.json @@ -53,5 +53,6 @@ }, "patternExportKeys": [], "patternExportDirectory": "./pattern_exports/", - "baseurl" : "" + "baseurl" : "", + "cacheBust": true } diff --git a/core/lib/patternlab.js b/core/lib/patternlab.js index 91d155f58..1d7dcf62a 100644 --- a/core/lib/patternlab.js +++ b/core/lib/patternlab.js @@ -54,6 +54,17 @@ var patternlab_engine = function (config) { } } + function setCacheBust() { + if (patternlab.config.cacheBust) { + if (patternlab.config.debug) { + console.log('setting cacheBuster value for frontend assets.'); + } + patternlab.cacheBuster = new Date().getTime(); + } else { + patternlab.cacheBuster = 0; + } + } + function buildPatterns(deletePatternDir) { patternlab.data = fs.readJSONSync(path.resolve(paths.source.data, 'data.json')); patternlab.listitems = fs.readJSONSync(path.resolve(paths.source.data, 'listitems.json')); @@ -64,6 +75,8 @@ var patternlab_engine = function (config) { patternlab.partials = {}; patternlab.data.link = {}; + setCacheBust(); + var pattern_assembler = new pa(), entity_encoder = new he(), pattern_exporter = new pe(), @@ -163,6 +176,10 @@ var patternlab_engine = function (config) { var allData = JSON.parse(JSON.stringify(patternlab.data)); allData = pattern_assembler.merge_data(allData, pattern.jsonFileData); + //also add the cachebuster value. slight chance this could collide with a user that has defined cacheBuster as a value + allData.cacheBuster = patternlab.cacheBuster; + pattern.cacheBuster = patternlab.cacheBuster; + //render the pattern-specific header var headHtml = pattern_assembler.renderPattern(pattern.header, allData); @@ -249,6 +266,9 @@ var patternlab_engine = function (config) { styleguidePatterns = patternlab.patterns; } + //also add the cachebuster value. slight chance this could collide with a user that has defined cacheBuster as a value + patternlab.data.cacheBuster = patternlab.cacheBuster; + //get the main page head and foot var mainPageHead = patternlab.userHead.extendedTemplate.replace('{% pattern-lab-head %}', patternlab.header); var mainPageHeadHtml = pattern_assembler.renderPattern(mainPageHead, patternlab.data); @@ -257,7 +277,7 @@ var patternlab_engine = function (config) { //build the styleguide var styleguideTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/styleguide.mustache'), 'utf8'), - styleguideHtml = pattern_assembler.renderPattern(styleguideTemplate, {partials: styleguidePatterns}); + styleguideHtml = pattern_assembler.renderPattern(styleguideTemplate, {partials: styleguidePatterns, cacheBuster: patternlab.cacheBuster}); fs.outputFileSync(path.resolve(paths.public.styleguide, 'html/styleguide.html'), mainPageHeadHtml + styleguideHtml + mainPageFootHtml); @@ -300,7 +320,7 @@ var patternlab_engine = function (config) { } var viewAllTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/viewall.mustache'), 'utf8'); - var viewAllHtml = pattern_assembler.renderPattern(viewAllTemplate, {partials: viewAllPatterns, patternPartial: patternPartial}); + var viewAllHtml = pattern_assembler.renderPattern(viewAllTemplate, {partials: viewAllPatterns, patternPartial: patternPartial, cacheBuster: patternlab.cacheBuster }); fs.outputFileSync(paths.public.patterns + pattern.subdir.slice(0, pattern.subdir.indexOf(pattern.patternGroup) + pattern.patternGroup.length) + '/index.html', mainPageHead + viewAllHtml + mainPageFoot); } @@ -327,7 +347,7 @@ var patternlab_engine = function (config) { } var viewAllTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/viewall.mustache'), 'utf8'); - var viewAllHtml = pattern_assembler.renderPattern(viewAllTemplate, {partials: viewAllPatterns, patternPartial: patternPartial}); + var viewAllHtml = pattern_assembler.renderPattern(viewAllTemplate, {partials: viewAllPatterns, patternPartial: patternPartial, cacheBuster: patternlab.cacheBuster}); fs.outputFileSync(paths.public.patterns + pattern.flatPatternPath + '/index.html', mainPageHeadHtml + viewAllHtml + mainPageFootHtml); } } @@ -523,7 +543,7 @@ var patternlab_engine = function (config) { var viewAllPathsPartialHtml = pattern_assembler.renderPattern(viewAllPathsTemplate, {'viewallpaths': JSON.stringify(patternlab.viewAllPaths)}); //render the patternlab template, with all partials - var patternlabSiteHtml = pattern_assembler.renderPattern(patternlabSiteTemplate, {}, { + var patternlabSiteHtml = pattern_assembler.renderPattern(patternlabSiteTemplate, {cacheBuster: patternlab.cacheBuster}, { 'ishControls': ishControlsPartialHtml, 'patternNav': patternNavPartialHtml, 'patternPaths': patternPathsPartialHtml, diff --git a/core/templates/index.mustache b/core/templates/index.mustache index 912839552..e3c1be462 100644 --- a/core/templates/index.mustache +++ b/core/templates/index.mustache @@ -12,10 +12,10 @@ - - - - + + + + @@ -86,17 +86,17 @@
- - - - + + + + {{> patternPaths }} {{> viewAllPaths }} - - - - - + + + + + diff --git a/core/templates/pattern-header-footer/footer.html b/core/templates/pattern-header-footer/footer.html index 9bdd04a87..b865c85ab 100644 --- a/core/templates/pattern-header-footer/footer.html +++ b/core/templates/pattern-header-footer/footer.html @@ -1,6 +1,6 @@ - - - - - + + + + + diff --git a/core/templates/pattern-header-footer/header.html b/core/templates/pattern-header-footer/header.html index 603079c27..ebe81993e 100644 --- a/core/templates/pattern-header-footer/header.html +++ b/core/templates/pattern-header-footer/header.html @@ -5,5 +5,5 @@ - - + +