shibori 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +27 -0
- data/Procfile +1 -0
- data/README.md +24 -0
- data/Rakefile +2 -0
- data/app.json +11 -0
- data/builder/lineage_hunter.js +80 -0
- data/builder/list_item_hunter.js +106 -0
- data/builder/media_hunter.js +51 -0
- data/builder/object_factory.js +60 -0
- data/builder/parameter_hunter.js +69 -0
- data/builder/pattern_assembler.js +258 -0
- data/builder/pattern_exporter.js +43 -0
- data/builder/patternlab.js +365 -0
- data/builder/patternlab_grunt.js +38 -0
- data/builder/patternlab_gulp.js +26 -0
- data/builder/pseudopattern_hunter.js +78 -0
- data/config.json +34 -0
- data/docs/Pattern Lab Node.md +225 -0
- data/favicon.ico +0 -0
- data/gulpfile.js +148 -0
- data/index.js +20 -0
- data/lib/shibori/version.rb +3 -0
- data/lib/shibori.rb +11 -0
- data/package.json +44 -0
- data/public/data/annotations.js +109 -0
- data/public/styleguide/css/static.css +458 -0
- data/public/styleguide/css/static.scss +404 -0
- data/public/styleguide/css/styleguide-specific.css +170 -0
- data/public/styleguide/css/styleguide-specific.scss +204 -0
- data/public/styleguide/css/styleguide.css +880 -0
- data/public/styleguide/css/styleguide.scss +950 -0
- data/public/styleguide/css/vendor/prism.css +112 -0
- data/public/styleguide/css/vendor/typeahead.css +66 -0
- data/public/styleguide/fonts/icomoon.eot +0 -0
- data/public/styleguide/fonts/icomoon.svg +22 -0
- data/public/styleguide/fonts/icomoon.ttf +0 -0
- data/public/styleguide/fonts/icomoon.woff +0 -0
- data/public/styleguide/html/README +1 -0
- data/public/styleguide/images/spinner.gif +0 -0
- data/public/styleguide/js/annotations-pattern.js +308 -0
- data/public/styleguide/js/annotations-viewer.js +289 -0
- data/public/styleguide/js/code-pattern.js +120 -0
- data/public/styleguide/js/code-viewer.js +443 -0
- data/public/styleguide/js/data-saver.js +169 -0
- data/public/styleguide/js/pattern-finder.js +114 -0
- data/public/styleguide/js/postmessage.js +127 -0
- data/public/styleguide/js/styleguide.js +600 -0
- data/public/styleguide/js/url-handler.js +182 -0
- data/public/styleguide/js/vendor/classlist-polyfill.js +176 -0
- data/public/styleguide/js/vendor/jquery.js +4 -0
- data/public/styleguide/js/vendor/jwerty.js +523 -0
- data/public/styleguide/js/vendor/prism.js +7 -0
- data/public/styleguide/js/vendor/typeahead.bundle.min.js +7 -0
- data/script/bootstrap +58 -0
- data/shibori.gemspec +18 -0
- data/shibori.jpg +0 -0
- data/source/_data/annotations.js +109 -0
- data/source/_data/data.json +93 -0
- data/source/_data/listitems.json +782 -0
- data/source/_patternlab-files/README +1 -0
- data/source/_patternlab-files/index.mustache +94 -0
- data/source/_patternlab-files/partials/ishControls.mustache +64 -0
- data/source/_patternlab-files/partials/patternNav.mustache +17 -0
- data/source/_patternlab-files/partials/patternPaths.mustache +3 -0
- data/source/_patternlab-files/partials/viewAllPaths.mustache +3 -0
- data/source/_patternlab-files/pattern-header-footer/README +1 -0
- data/source/_patternlab-files/pattern-header-footer/footer.html +34 -0
- data/source/_patternlab-files/pattern-header-footer/header.html +44 -0
- data/source/_patternlab-files/styleguide.mustache +75 -0
- data/source/_patternlab-files/viewall.mustache +75 -0
- data/source/_patterns/00-atoms/00-typography/00-headings.mustache +6 -0
- data/source/_patterns/00-atoms/00-typography/01-headings-options.mustache +7 -0
- data/source/_patterns/00-atoms/00-typography/02-body.mustache +2 -0
- data/source/_patterns/00-atoms/00-typography/03-text-manipulation.mustache +12 -0
- data/source/_patterns/00-atoms/00-typography/04-blockquotes.mustache +3 -0
- data/source/_patterns/00-atoms/00-typography/05-lists.mustache +64 -0
- data/source/_patterns/00-atoms/01-colors/00-colors-monochromatic.mustache +36 -0
- data/source/_patterns/00-atoms/01-colors/01-colors-brand.mustache +26 -0
- data/source/_patterns/00-atoms/01-colors/02-colors-gradients.mustache +38 -0
- data/source/_patterns/00-atoms/02-buttons/00-btn-lg.mustache +7 -0
- data/source/_patterns/00-atoms/02-buttons/01-btn-sm.mustache +7 -0
- data/source/_patterns/00-atoms/02-buttons/02-btn-xs.mustache +7 -0
- data/source/_patterns/00-atoms/02-buttons/03-btn-block.mustache +7 -0
- data/source/_patterns/00-atoms/02-buttons/04-btn-deploy.mustache +4 -0
- data/source/_patterns/00-atoms/03-forms/00-text-fields.mustache +24 -0
- data/source/_patterns/00-atoms/03-forms/01-select-menu.mustache +6 -0
- data/source/_patterns/00-atoms/03-forms/02-checkbox.mustache +10 -0
- data/source/_patterns/00-atoms/03-forms/03-radios.mustache +10 -0
- data/source/_patterns/00-atoms/03-forms/04-validation.mustache +14 -0
- data/source/_patterns/00-atoms/04-quote/00-pullquote.mustache +7 -0
- data/source/_patterns/00-atoms/04-quote/01-quote-small.mustache +7 -0
- data/source/_patterns/00-atoms/05-code/01-pre.mustache +11 -0
- data/source/_patterns/00-atoms/06-tooltips/00-text.mustache +3 -0
- data/source/_patterns/00-atoms/06-tooltips/01-diagram-callout.mustache +1 -0
- data/source/_patterns/00-atoms/07-loader/00-spinner.mustache +5 -0
- data/source/_patterns/00-atoms/08-readmore/00-readmore.mustache +3 -0
- data/source/_patterns/00-atoms/09-slider/00-dots.mustache +8 -0
- data/source/_patterns/00-atoms/10-tables/00-tables.mustache +26 -0
- data/source/_patterns/00-atoms/12-modal/00-modal.mustache +14 -0
- data/source/_patterns/00-atoms/13-panel/00-panel.mustache +3 -0
- data/source/_patterns/00-atoms/14-users/00-avatar.mustache +3 -0
- data/source/_patterns/00-atoms/15-icons/00-icons.mustache +333 -0
- data/source/_patterns/00-atoms/15-icons/04-icon-colors.mustache +38 -0
- data/source/_patterns/00-atoms/15-icons/05-icon-sizes.mustache +31 -0
- data/source/_patterns/00-atoms/15-icons/_02-languages.mustache +0 -0
- data/source/_patterns/00-atoms/15-icons/_03-social.mustache +0 -0
- data/source/_patterns/00-atoms/15-icons/_05-icon-containers.mustache +0 -0
- data/source/_patterns/00-atoms/16-video/01-video.mustache +3 -0
- data/source/_patterns/00-atoms/16-video/_00-play-button.mustache +0 -0
- data/source/_patterns/00-atoms/17-utilities/00-visibility.mustache +8 -0
- data/source/_patterns/00-atoms/17-utilities/01-ui-elements.mustache +3 -0
- data/source/_patterns/00-atoms/18-grid/_00-grid.mustache +0 -0
- data/source/_patterns/01-molecules/00-text/00-header-groups.mustache +4 -0
- data/source/_patterns/01-molecules/00-text/01-intro-text.mustache +5 -0
- data/source/_patterns/01-molecules/01-layout/00-one-up.mustache +8 -0
- data/source/_patterns/01-molecules/01-layout/01-two-up.mustache +9 -0
- data/source/_patterns/01-molecules/01-layout/02-three-up.mustache +10 -0
- data/source/_patterns/01-molecules/01-layout/03-four-up.mustache +11 -0
- data/source/_patterns/01-molecules/01-layout/04-masonary-2.mustache +24 -0
- data/source/_patterns/01-molecules/01-layout/05-masonary-3.mustache +24 -0
- data/source/_patterns/01-molecules/02-navigation/01-subnav.mustache +21 -0
- data/source/_patterns/01-molecules/02-navigation/02-breadcrumbs.mustache +25 -0
- data/source/_patterns/01-molecules/02-navigation/03-side-nav.mustache +11 -0
- data/source/_patterns/01-molecules/02-navigation/04-side-nav-small.mustache +32 -0
- data/source/_patterns/01-molecules/02-navigation/05-pagination.mustache +0 -0
- data/source/_patterns/01-molecules/02-navigation/06-tabs.mustache +46 -0
- data/source/_patterns/01-molecules/03-forms/_00-search.mustache +0 -0
- data/source/_patterns/01-molecules/04-slider/00-slider.mustache +8 -0
- data/source/_patterns/01-molecules/05-messages/00-alert.mustache +15 -0
- data/source/_patterns/01-molecules/06-components/_00-social-share.mustache +0 -0
- data/source/_patterns/01-molecules/07-Elements/01-Addons-Card.mustache +79 -0
- data/source/_patterns/01-molecules/07-Elements/02-Buttons-Card.mustache +131 -0
- data/source/_patterns/01-molecules/07-Elements/03-Buildpack-Card.mustache +109 -0
- data/source/_patterns/01-molecules/08-vertical-tabs/01-vertical-tabs.mustache +30 -0
- data/source/_patterns/02-organisms/03-sections/00-purple.mustache +11 -0
- data/source/_patterns/02-organisms/03-sections/01-purple-dark.mustache +12 -0
- data/source/_patterns/02-organisms/03-sections/03-gray-light.mustache +12 -0
- data/source/css/hk-icon-rails.scss +13 -0
- data/source/css/scss/base/_base.scss +62 -0
- data/source/css/scss/base/_fonts.scss +12 -0
- data/source/css/scss/base/_normalize.scss +431 -0
- data/source/css/scss/base/_type.scss +128 -0
- data/source/css/scss/base/_utilities.scss +78 -0
- data/source/css/scss/components/_alert.scss +38 -0
- data/source/css/scss/components/_animate.scss +3340 -0
- data/source/css/scss/components/_animation.scss +15 -0
- data/source/css/scss/components/_buttons.scss +175 -0
- data/source/css/scss/components/_code.scss +26 -0
- data/source/css/scss/components/_forms.scss +136 -0
- data/source/css/scss/components/_hero.scss +18 -0
- data/source/css/scss/components/_hr.scss +11 -0
- data/source/css/scss/components/_icons.scss +85 -0
- data/source/css/scss/components/_lists.scss +45 -0
- data/source/css/scss/components/_logos.scss +15 -0
- data/source/css/scss/components/_masonary.scss +46 -0
- data/source/css/scss/components/_modal.scss +218 -0
- data/source/css/scss/components/_owlCarousel.scss +270 -0
- data/source/css/scss/components/_panel.scss +11 -0
- data/source/css/scss/components/_pill-box.scss +38 -0
- data/source/css/scss/components/_quote.scss +96 -0
- data/source/css/scss/components/_readmore.scss +11 -0
- data/source/css/scss/components/_slider.scss +96 -0
- data/source/css/scss/components/_spinner.scss +64 -0
- data/source/css/scss/components/_sprites.scss +3 -0
- data/source/css/scss/components/_sr-only.scss +10 -0
- data/source/css/scss/components/_tables.scss +62 -0
- data/source/css/scss/components/_tooltips.scss +93 -0
- data/source/css/scss/components/_users.scss +11 -0
- data/source/css/scss/components/_vertical-tabs.scss +129 -0
- data/source/css/scss/components/_video.scss +7 -0
- data/source/css/scss/ecosystem/_addons-card.scss +3 -0
- data/source/css/scss/ecosystem/_cards.scss +369 -0
- data/source/css/scss/ecosystem/_elements-brand.scss +32 -0
- data/source/css/scss/ecosystem/_elements.scss +4 -0
- data/source/css/scss/globals/_colors.scss +189 -0
- data/source/css/scss/globals/_mixins.scss +45 -0
- data/source/css/scss/globals/_variables.scss +87 -0
- data/source/css/scss/layout/_grid-settings.scss +13 -0
- data/source/css/scss/layout/_layout.scss +95 -0
- data/source/css/scss/page-elements/_headers.scss +3 -0
- data/source/css/scss/page-elements/_navigation.scss +254 -0
- data/source/css/scss/page-elements/_sections.scss +66 -0
- data/source/css/scss/page-elements/_sidebar.scss +34 -0
- data/source/css/shibori.scss +63 -0
- data/source/fonts/bentonsans/bentonsans-book.eot +0 -0
- data/source/fonts/bentonsans/bentonsans-book.svg +400 -0
- data/source/fonts/bentonsans/bentonsans-book.ttf +0 -0
- data/source/fonts/bentonsans/bentonsans-book.woff +0 -0
- data/source/fonts/bentonsans/bentonsans-medium.eot +0 -0
- data/source/fonts/bentonsans/bentonsans-medium.svg +416 -0
- data/source/fonts/bentonsans/bentonsans-medium.ttf +0 -0
- data/source/fonts/bentonsans/bentonsans-medium.woff +0 -0
- data/source/fonts/bentonsans/bentonsans-regular.eot +0 -0
- data/source/fonts/bentonsans/bentonsans-regular.svg +416 -0
- data/source/fonts/bentonsans/bentonsans-regular.ttf +0 -0
- data/source/fonts/bentonsans/bentonsans-regular.woff +0 -0
- data/source/fonts/hk-icon/hk-icon.eot +0 -0
- data/source/fonts/hk-icon/hk-icon.svg +261 -0
- data/source/fonts/hk-icon/hk-icon.ttf +0 -0
- data/source/fonts/hk-icon/hk-icon.woff +0 -0
- data/source/fonts/inconsolata/inconsolata-bold.eot +0 -0
- data/source/fonts/inconsolata/inconsolata-bold.svg +239 -0
- data/source/fonts/inconsolata/inconsolata-bold.ttf +0 -0
- data/source/fonts/inconsolata/inconsolata-bold.woff +0 -0
- data/source/fonts/inconsolata/inconsolata-regular.eot +0 -0
- data/source/fonts/inconsolata/inconsolata-regular.svg +239 -0
- data/source/fonts/inconsolata/inconsolata-regular.ttf +0 -0
- data/source/fonts/inconsolata/inconsolata-regular.woff +0 -0
- data/source/images/blockquote/close-sm.png +0 -0
- data/source/images/blockquote/close.png +0 -0
- data/source/images/blockquote/close@2x.png +0 -0
- data/source/images/blockquote/open-sm.png +0 -0
- data/source/images/blockquote/open.png +0 -0
- data/source/images/blockquote/open@2x.png +0 -0
- data/source/images/elements/heroku_suported.svg +32 -0
- data/source/images/forms/select-input-arrows.svg +8 -0
- data/source/js/init.js +26 -0
- data/source/js/main.js +22 -0
- data/source/js/vendor/bourbon-modal.js +17 -0
- data/source/js/vendor/fitvids.js +77 -0
- data/source/js/vendor/fixto.js +719 -0
- data/source/js/vendor/jquery-2.0.0b2.js +8690 -0
- data/source/js/vendor/modernizr.js +4 -0
- data/source/js/vendor/owl.carousel.js +3069 -0
- data/source/js/vendor/readmore.js +11 -0
- data/source/js/vendor/unslider.js +1 -0
- data/source/js/vendor/vertical-tabs.js +34 -0
- data/test/files/test.css +19 -0
- data/test/lineage_hunter_tests.js +262 -0
- data/test/list_item_hunter_tests.js +167 -0
- data/test/media_hunter_tests.js +74 -0
- data/test/object_factory_tests.js +62 -0
- data/test/parameter_hunter_tests.js +298 -0
- data/test/pattern_assembler_tests.js +43 -0
- data/test/patternlab_tests.js +8 -0
- metadata +320 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
var patternlab_engine = require('./patternlab.js');
|
2
|
+
|
3
|
+
module.exports = function(gulp) {
|
4
|
+
|
5
|
+
gulp.task('patternlab', ['clean'], function(cb){
|
6
|
+
var patternlab = patternlab_engine();
|
7
|
+
patternlab.build(false);
|
8
|
+
cb();
|
9
|
+
});
|
10
|
+
|
11
|
+
gulp.task('patternlab:version', function(){
|
12
|
+
var patternlab = patternlab_engine();
|
13
|
+
patternlab.version();
|
14
|
+
})
|
15
|
+
|
16
|
+
gulp.task('patternlab:only_patterns', ['clean'], function(){
|
17
|
+
var patternlab = patternlab_engine();
|
18
|
+
patternlab.build_patterns_only(false);
|
19
|
+
})
|
20
|
+
|
21
|
+
gulp.task('patternlab:help', function(){
|
22
|
+
var patternlab = patternlab_engine();
|
23
|
+
patternlab.help();
|
24
|
+
})
|
25
|
+
|
26
|
+
}
|
@@ -0,0 +1,78 @@
|
|
1
|
+
/**
|
2
|
+
* Heroku-Patterns - v0.2.0 - 2016
|
3
|
+
*
|
4
|
+
* , and the web community.
|
5
|
+
* Licensed under the license.
|
6
|
+
*
|
7
|
+
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
|
8
|
+
*
|
9
|
+
**/(function () {
|
10
|
+
"use strict";
|
11
|
+
|
12
|
+
var pseudopattern_hunter = function(){
|
13
|
+
|
14
|
+
function findpseudopatterns(currentPattern, patternlab){
|
15
|
+
|
16
|
+
var glob = require('glob'),
|
17
|
+
fs = require('fs-extra'),
|
18
|
+
pa = require('./pattern_assembler'),
|
19
|
+
lh = require('./lineage_hunter'),
|
20
|
+
of = require('./object_factory'),
|
21
|
+
mustache = require('mustache');
|
22
|
+
|
23
|
+
var pattern_assembler = new pa();
|
24
|
+
var lineage_hunter = new lh();
|
25
|
+
|
26
|
+
//look for a pseudo pattern by checking if there is a file containing same name, with ~ in it, ending in .json
|
27
|
+
var needle = currentPattern.subdir + '/' + currentPattern.fileName + '~*.json';
|
28
|
+
var pseudoPatterns = glob.sync(needle, {
|
29
|
+
cwd: 'source/_patterns/', //relative to gruntfile
|
30
|
+
debug: false,
|
31
|
+
nodir: true,
|
32
|
+
});
|
33
|
+
|
34
|
+
if(pseudoPatterns.length > 0){
|
35
|
+
|
36
|
+
for(var i = 0; i < pseudoPatterns.length; i++){
|
37
|
+
|
38
|
+
if(patternlab.config.debug){
|
39
|
+
console.log('found pseudoPattern variant of ' + currentPattern.key);
|
40
|
+
}
|
41
|
+
|
42
|
+
//we want to do everything we normally would here, except instead head the pseudoPattern data
|
43
|
+
var variantFileData = fs.readJSONSync('source/_patterns/' + pseudoPatterns[i]);
|
44
|
+
|
45
|
+
//extend any existing data with variant data
|
46
|
+
variantFileData = pattern_assembler.merge_data(variantFileData, currentPattern.jsonFileData);
|
47
|
+
|
48
|
+
var variantName = pseudoPatterns[i].substring(pseudoPatterns[i].indexOf('~') + 1).split('.')[0];
|
49
|
+
var patternVariant = new of.oPattern(currentPattern.subdir, currentPattern.fileName + '-' + variantName + '.mustache', variantFileData);
|
50
|
+
|
51
|
+
//see if this file has a state
|
52
|
+
pattern_assembler.setPatternState(patternVariant, patternlab);
|
53
|
+
|
54
|
+
//use the same template as the non-variant
|
55
|
+
patternVariant.template = currentPattern.template;
|
56
|
+
patternVariant.extendedTemplate = currentPattern.extendedTemplate;
|
57
|
+
|
58
|
+
//find pattern lineage
|
59
|
+
lineage_hunter.find_lineage(patternVariant, patternlab);
|
60
|
+
|
61
|
+
//add to patternlab object so we can look these up later.
|
62
|
+
pattern_assembler.addPattern(patternVariant, patternlab);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
}
|
67
|
+
|
68
|
+
return {
|
69
|
+
find_pseudopatterns: function(pattern, patternlab){
|
70
|
+
findpseudopatterns(pattern, patternlab);
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
};
|
75
|
+
|
76
|
+
module.exports = pseudopattern_hunter;
|
77
|
+
|
78
|
+
}());
|
data/config.json
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
{
|
2
|
+
"patterns" : {
|
3
|
+
"source" : "./source/_patterns/",
|
4
|
+
"public" : "./public/patterns/"
|
5
|
+
},
|
6
|
+
"ignored-extensions" : ["scss", "DS_Store", "less"],
|
7
|
+
"ignored-directories" : ["scss"],
|
8
|
+
"debug": false,
|
9
|
+
"ishControlsVisible": {
|
10
|
+
"s": true,
|
11
|
+
"m": true,
|
12
|
+
"l": true,
|
13
|
+
"full": true,
|
14
|
+
"random": true,
|
15
|
+
"disco": true,
|
16
|
+
"hay": true,
|
17
|
+
"mqs": true,
|
18
|
+
"find": true,
|
19
|
+
"views-all": true,
|
20
|
+
"views-annotations": true,
|
21
|
+
"views-code": true,
|
22
|
+
"views-new": true,
|
23
|
+
"tools-all": true,
|
24
|
+
"tools-sync": true,
|
25
|
+
"tools-shortcuts": true,
|
26
|
+
"tools-docs": true
|
27
|
+
},
|
28
|
+
"patternStates": {
|
29
|
+
"homepage-emergency" : "inprogress"
|
30
|
+
},
|
31
|
+
"patternExportKeys": [],
|
32
|
+
"patternExportDirectory": "./pattern_exports/",
|
33
|
+
"baseurl" : ""
|
34
|
+
}
|
@@ -0,0 +1,225 @@
|
|
1
|
+
## Heroku WWW Marketing Pattern Lab
|
2
|
+
|
3
|
+
This style guide uses [Pattern Lab](http://patternlab.io/). It combines platform-agnostic assets, like the Mustache-based patterns, the JavaScript-based viewer, and the self-contained webserver, with a Node-based "builder" that transforms and dynamically builds the Pattern Lab site.
|
4
|
+
|
5
|
+
### Getting Started
|
6
|
+
|
7
|
+
1. Run `npm install` from the command line
|
8
|
+
2. Run `gulp` or `gulp serve` from the command line
|
9
|
+
|
10
|
+
This creates all patterns, the styleguide, and the pattern lab site. `gulp serve` will have BrowserSync spin up and serve the files.
|
11
|
+
|
12
|
+
### Command Line Interface
|
13
|
+
|
14
|
+
The following are gulp task arguments you may execute:
|
15
|
+
|
16
|
+
##### `patternlab`
|
17
|
+
With no arguments, patternlab runs the full builder, compiling patterns, and constructing the front-end site.
|
18
|
+
|
19
|
+
##### `patternlab:only_patterns`
|
20
|
+
Compile the patterns only, outputting to ./public/patterns
|
21
|
+
|
22
|
+
##### `patternlab:v`
|
23
|
+
Retrieve the version of patternlab-node you have installed
|
24
|
+
|
25
|
+
##### `patternlab:help`
|
26
|
+
Get more information about patternlab-node, pattern lab in general, and where to report issues.
|
27
|
+
|
28
|
+
##### Nav Bar Controls
|
29
|
+
If you don't have a need for some of the nav-bar tools in the Pattern Lab frontend, you can turn them off in `config.json`.
|
30
|
+
|
31
|
+
The current selection is as follows.
|
32
|
+
|
33
|
+
```
|
34
|
+
"ishControlsVisible": {
|
35
|
+
"s": true,
|
36
|
+
"m": true,
|
37
|
+
"l": true,
|
38
|
+
"full": true,
|
39
|
+
"random": true,
|
40
|
+
"disco": true,
|
41
|
+
"hay": true,
|
42
|
+
"mqs": false,
|
43
|
+
"find": false,
|
44
|
+
"views-all": true,
|
45
|
+
"views-annotations": true,
|
46
|
+
"views-code": true,
|
47
|
+
"views-new": true,
|
48
|
+
"tools-all": true,
|
49
|
+
"tools-follow": false,
|
50
|
+
"tools-reload": false,
|
51
|
+
"tools-shortcuts": false,
|
52
|
+
"tools-docs": true
|
53
|
+
}
|
54
|
+
```
|
55
|
+
##### Pattern States
|
56
|
+
You can set the state of a pattern by including it in `config.json` too. The out of the box styles are in progress (orange), in review (yellow), and complete (green).
|
57
|
+
Pattern states should be lowercase and use hyphens where spaces are present.
|
58
|
+
```
|
59
|
+
"patternStates": {
|
60
|
+
"colors" : "inprogress",
|
61
|
+
"fonts" : "inreview",
|
62
|
+
"three-up" : "complete"
|
63
|
+
}
|
64
|
+
```
|
65
|
+
|
66
|
+
##### Pattern Export
|
67
|
+
`config.json` also has two properties that work together to export completed patterns for use in a production environment. Provide an array of keys and an output directory. Pattern Lab doesn't ship with any pattern export keys, but the default directory is `"./pattern_exports/"` created inside the install directory.
|
68
|
+
|
69
|
+
```
|
70
|
+
"patternExportKeys": ["molecules-primary-nav", "organisms-header", "organisms-header"],
|
71
|
+
"patternExportDirectory": "./pattern_exports/"
|
72
|
+
```
|
73
|
+
|
74
|
+
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.
|
75
|
+
|
76
|
+
##### baseurl
|
77
|
+
|
78
|
+
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`
|
79
|
+
|
80
|
+
```
|
81
|
+
"baseurl" : "/patterns-demo"
|
82
|
+
```
|
83
|
+
|
84
|
+
Default: blank
|
85
|
+
|
86
|
+
##### excluding patterns
|
87
|
+
|
88
|
+
If you'd like to exclude an individual pattern you can do so by prepending the filename with an underscore, like: `_filename.mustache`
|
89
|
+
|
90
|
+
You can also exclude complete directories by prepending the directory name with an underscore, like: `/_experiment/...`
|
91
|
+
|
92
|
+
##### Debug Mode
|
93
|
+
`patternlab.json` is a file created for debugging purposes. Set `debug` to true in `.config.json` to see all the secrets.
|
94
|
+
|
95
|
+
##### Server & BrowserSync
|
96
|
+
Running `gulp serve` will compile the Pattern Lab frontend and host it by default on <a href="http://localhost:3000">http://localhost:3000</a> via [BrowserSync](http://www.browsersync.io/docs/). After it starts, templates, `data.json`, and scss/css changes in your source code will be automatically injected into the page.
|
97
|
+
|
98
|
+
You'll notice that if you have this open across different browsers, we do our best to keep the frontend in sync, but there is a known issue with synced navigation using the main menu.
|
99
|
+
|
100
|
+
### Advanced Pattern Library Features
|
101
|
+
|
102
|
+
##### Pattern Parameters
|
103
|
+
Pattern parameters are a simple mechanism for replacing Mustache variables via attributes on a pattern partial tag rather than having to use a pattern-specific json file. They are especially useful when you want to supply distinct values for Mustache variables in a specific pattern partial instance that may be included multiple times in a molecule, template, or page.
|
104
|
+
|
105
|
+
The basic syntax is this:
|
106
|
+
|
107
|
+
```
|
108
|
+
{{> molecules-single-comment(description: 'A life is like a garden. Perfect moments can be had, but not preserved, except in memory.') }}
|
109
|
+
```
|
110
|
+
|
111
|
+
The attributes listed in the pattern parameters should match Mustache variable names in your pattern. The values listed for each attribute will replace the Mustache variables. Again, pattern parameters are a simple find and replace of Mustache variables with the supplied values.
|
112
|
+
|
113
|
+
Pattern parameters **do not** currently support the following:
|
114
|
+
|
115
|
+
* sub-lists (e.g. iteration of a section),
|
116
|
+
* and the use of long strings of text can be unwieldy
|
117
|
+
* nested properties within the parameter data, such as `{{> molecules-single-comment(foo.bar: 'baz') }}`
|
118
|
+
|
119
|
+
You can read the full documentation on pattern parameters here: [Using Pattern Parameters](http://patternlab.io/docs/pattern-parameters.html)
|
120
|
+
|
121
|
+
##### Pseudo-Patterns
|
122
|
+
Pseudo-patterns are meant to give developers the ability to build multiple and unique **rendered** patterns off of one base pattern and its mark-up while giving them control over the data that is injected into the base pattern. This feature is especially useful when developing template- and page-style patterns.
|
123
|
+
|
124
|
+
Pseudo-patterns are, essentially, the pattern-specific JSON files that would accompany a pattern. Rather than require a Mustache pattern, though, pseudo-patterns are hinted so a developer can reference a shared pattern. The basic syntax:
|
125
|
+
|
126
|
+
`patternName~pseudoPatternName.json`
|
127
|
+
|
128
|
+
The tilde, `~`, and JSON extension denotes that this is a pseudo-pattern. `patternName` is the parent pattern that will be used when rendering the pseudo-pattern. `patternName` and `pseudoPatternName` are combined when adding the pseudo-pattern to the navigation.
|
129
|
+
|
130
|
+
The JSON file itself works exactly like the [pattern-specific JSON file](http://patternlab.io/docs/data-pattern-specific.html). It has the added benefit that the pseudo-pattern will also import any values from the parent pattern's pattern-specific JSON file. Here is an example (which ships with the package) where we want to show an emergency notification on our homepage template. Our `03-templates/` directory looks like this:
|
131
|
+
|
132
|
+
```
|
133
|
+
00-homepage.mustache
|
134
|
+
01-blog.mustache
|
135
|
+
02-article.mustache
|
136
|
+
```
|
137
|
+
|
138
|
+
Our `00-homepage.mustache` template might look like this:
|
139
|
+
|
140
|
+
```
|
141
|
+
<div id="main-container">
|
142
|
+
{{# emergency }}
|
143
|
+
<div class="emergency">Oh Noes! Emergency!</div>
|
144
|
+
{{/ emergency }}
|
145
|
+
{ ...a bunch of other content... }
|
146
|
+
</div>
|
147
|
+
```
|
148
|
+
|
149
|
+
If our `_data.json` file doesn't give a value for `emergency` that section will never show up when `00-homepage.mustache` is rendered.
|
150
|
+
|
151
|
+
We want to show both the regular and emergency states of the homepage but we don't want to duplicate the entire `00-homepage.mustache` template. That would be a maintenance nightmare. So let's add our pseudo-pattern:
|
152
|
+
|
153
|
+
```
|
154
|
+
00-homepage.mustache
|
155
|
+
00-homepage~emergency.json
|
156
|
+
01-blog.mustache
|
157
|
+
02-article.mustache
|
158
|
+
```
|
159
|
+
|
160
|
+
In our pseudo-pattern, `00-homepage~emergency.json`, we add our `emergency` attribute:
|
161
|
+
|
162
|
+
```
|
163
|
+
{
|
164
|
+
"emergency": true
|
165
|
+
}
|
166
|
+
```
|
167
|
+
|
168
|
+
Now when we generate our site we'll have our homepage template rendered twice. Once as the regular template and once as a pseudo-pattern showing the emergency section. Note that the pseudo-pattern will show up in our navigation as `Homepage Emergency`.
|
169
|
+
|
170
|
+
##### Pattern Linking
|
171
|
+
You can build patterns that link to one another to help simulate using a real website. This is especially useful when working with the Pages and Templates pattern types. The basic format is:
|
172
|
+
|
173
|
+
`{{ link.pattern-name }}`
|
174
|
+
|
175
|
+
For example, if you wanted to add a link to the `home page` template from your `blog` template you could write the following:
|
176
|
+
|
177
|
+
`<a href="{{ link.templates-homepage }}">Home</a>`
|
178
|
+
|
179
|
+
This would compile to:
|
180
|
+
|
181
|
+
`<a href="/patterns/templates-homepage/templates-homepage.html">Home</a>`
|
182
|
+
|
183
|
+
As you can see, it's a much easier way of linking patterns to one another.
|
184
|
+
|
185
|
+
===
|
186
|
+
|
187
|
+
## Working with Patterns
|
188
|
+
|
189
|
+
(The following documentation is built for the PHP version of Pattern Lab, but most applies to the node version too. If you find omissions or mistakes please open an issue.)
|
190
|
+
|
191
|
+
Patterns are the core element of Pattern Lab. Understanding how they work is the key to getting the most out of the system. Patterns use [Mustache](http://mustache.github.io/) so please read [Mustache's docs](http://mustache.github.io/mustache.5.html) as well.
|
192
|
+
|
193
|
+
* [How Patterns Are Organized](http://patternlab.io/docs/pattern-organization.html)
|
194
|
+
* [Adding New Patterns](http://patternlab.io/docs/pattern-add-new.html)
|
195
|
+
* [Reorganizing Patterns](http://patternlab.io/docs/pattern-reorganizing.html)
|
196
|
+
* [Including One Pattern Within Another via Partials](http://patternlab.io/docs/pattern-including.html)
|
197
|
+
* [Managing Assets for a Pattern: JavaScript, images, CSS, etc.](http://patternlab.io/docs/pattern-managing-assets.html)
|
198
|
+
* [Modifying the Pattern Header and Footer](http://patternlab.io/docs/pattern-header-footer.html)
|
199
|
+
* [Using Pattern Parameters](http://patternlab.io/docs/pattern-parameters.html)
|
200
|
+
* [Using Pattern State](http://patternlab.io/docs/pattern-states.html)
|
201
|
+
* ["Hiding" Patterns in the Navigation](http://patternlab.io/docs/pattern-hiding.html)
|
202
|
+
* [Adding Annotations](http://patternlab.io/docs/pattern-adding-annotations.html)
|
203
|
+
* [Viewing Patterns on a Mobile Device](http://patternlab.io/docs/pattern-mobile-view.html)
|
204
|
+
|
205
|
+
## Creating & Working With Dynamic Data for a Pattern
|
206
|
+
|
207
|
+
The Node version of Pattern Lab utilizes Mustache as the template language for patterns. In addition to allowing for the [inclusion of one pattern within another](http://patternlab.io/docs/pattern-including.html) it also gives pattern developers the ability to include variables. This means that attributes like image sources can be centralized in one file for easy modification across one or more patterns. The Node version of Pattern Lab uses a JSON file, `source/_data/data.json`, to centralize many of these attributes.
|
208
|
+
|
209
|
+
* [Introduction to JSON & Mustache Variables](http://patternlab.io/docs/data-json-mustache.html)
|
210
|
+
* [Overriding the Central `data.json` Values with Pattern-specific Values](http://patternlab.io/docs/data-pattern-specific.html)
|
211
|
+
* [Linking to Patterns with Pattern Lab's Default `link` Variable](http://patternlab.io/docs/data-link-variable.html)
|
212
|
+
* [Creating Lists with Pattern Lab's Default `listItems` Variable](http://patternlab.io/docs/data-listitems.html)
|
213
|
+
|
214
|
+
## Using Pattern Lab's Advanced Features
|
215
|
+
|
216
|
+
By default, the Pattern Lab assets can be manually generated and the Pattern Lab site manually refreshed but who wants to waste time doing that? Here are some ways that Pattern Lab can make your development workflow a little smoother:
|
217
|
+
|
218
|
+
* [Watching for Changes and Auto-Regenerating Patterns](http://patternlab.io/docs/advanced-auto-regenerate.html) - Node version coming soon
|
219
|
+
* [Auto-Reloading the Browser Window When Changes Are Made](http://patternlab.io/docs/advanced-reload-browser.html) - Node version coming soon
|
220
|
+
* [Multi-browser & Multi-device Testing with Page Follow](http://patternlab.io/docs/advanced-page-follow.html)
|
221
|
+
* [Keyboard Shortcuts](http://patternlab.io/docs/advanced-keyboard-shortcuts.html)
|
222
|
+
* [Special Pattern Lab-specific Query String Variables ](http://patternlab.io/docs/pattern-linking.html)
|
223
|
+
* [Preventing the Cleaning of public/](http://patternlab.io/docs/advanced-clean-public.html) - Node version coming soon
|
224
|
+
* [Modifying the Pattern Lab Nav](http://patternlab.io/docs/advanced-pattern-lab-nav.html) - Node version coming soon
|
225
|
+
* [Editing the config.ini Options](http://patternlab.io/docs/advanced-config-options.html) - Node version coming soon
|
data/favicon.ico
ADDED
Binary file
|
data/gulpfile.js
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
'use strict'
|
2
|
+
|
3
|
+
var pkg = require('./package.json'),
|
4
|
+
gulp = require('gulp'),
|
5
|
+
eol = require('os').EOL,
|
6
|
+
del = require('del'),
|
7
|
+
strip_banner = require('gulp-strip-banner'),
|
8
|
+
header = require('gulp-header'),
|
9
|
+
nodeunit = require('gulp-nodeunit'),
|
10
|
+
bourbon = require('node-bourbon'),
|
11
|
+
neat = require('node-neat'),
|
12
|
+
sass = require('gulp-sass'),
|
13
|
+
browserSync = require('browser-sync').create();
|
14
|
+
|
15
|
+
require('gulp-load')(gulp);
|
16
|
+
var banner = [ '/** ',
|
17
|
+
' * <%= pkg.name %> - v<%= pkg.version %> - <%= today %>',
|
18
|
+
' * ',
|
19
|
+
' * <%= pkg.author %>, and the web community.',
|
20
|
+
' * Licensed under the <%= pkg.license %> license.',
|
21
|
+
' * ',
|
22
|
+
' * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.',
|
23
|
+
' * ', ' **/'].join(eol);
|
24
|
+
|
25
|
+
//load patternlab-node tasks
|
26
|
+
gulp.loadTasks(__dirname+'/builder/patternlab_gulp.js');
|
27
|
+
|
28
|
+
//clean patterns dir
|
29
|
+
gulp.task('clean', function(cb){
|
30
|
+
del.sync(['./public/patterns/*'], {force: true});
|
31
|
+
cb();
|
32
|
+
})
|
33
|
+
|
34
|
+
//build the banner
|
35
|
+
gulp.task('banner', function(){
|
36
|
+
return gulp.src([
|
37
|
+
'./builder/patternlab.js',
|
38
|
+
'./builder/object_factory.js',
|
39
|
+
'./builder/lineage_hunter.js',
|
40
|
+
'./builder/media_hunter.js',
|
41
|
+
'./builder/patternlab_grunt.js',
|
42
|
+
'./builder/parameter_hunter.js',
|
43
|
+
'./builder/pattern_exporter.js',
|
44
|
+
'./builder/pattern_assembler.js',
|
45
|
+
'./builder/pseudopattern_hunter.js',
|
46
|
+
'./builder/list_item_hunter.js'
|
47
|
+
])
|
48
|
+
.pipe(strip_banner())
|
49
|
+
.pipe(header( banner, {
|
50
|
+
pkg : pkg,
|
51
|
+
today : new Date().getFullYear() }
|
52
|
+
))
|
53
|
+
.pipe(gulp.dest('./builder'));
|
54
|
+
})
|
55
|
+
|
56
|
+
//copy tasks
|
57
|
+
gulp.task('cp:js', function(){
|
58
|
+
return gulp.src('**/*.js', {cwd:'./source/js'})
|
59
|
+
.pipe(gulp.dest('./public/js'))
|
60
|
+
});
|
61
|
+
gulp.task('cp:img', function(){
|
62
|
+
return gulp.src(
|
63
|
+
[ '**/*.gif', '**/*.png', '**/*.jpg', '**/*.jpeg', '**/*.svg' ],
|
64
|
+
{cwd:'./source/images'} )
|
65
|
+
.pipe(gulp.dest('./public/images'))
|
66
|
+
});
|
67
|
+
gulp.task('cp:font', function(){
|
68
|
+
return gulp.src(['*', '**/*' ],
|
69
|
+
{cwd:'./source/fonts'} )
|
70
|
+
.pipe(gulp.dest('./public/fonts'))
|
71
|
+
});
|
72
|
+
gulp.task('cp:data', function(){
|
73
|
+
return gulp.src('annotations.js', {cwd:'./source/_data'})
|
74
|
+
.pipe(gulp.dest('./public/data'))
|
75
|
+
})
|
76
|
+
gulp.task('cp:css', function(){
|
77
|
+
return gulp.src('./source/css/shibori.css')
|
78
|
+
.pipe(gulp.dest('./public/css'))
|
79
|
+
.pipe(browserSync.stream());
|
80
|
+
})
|
81
|
+
|
82
|
+
//server and watch tasks
|
83
|
+
gulp.task('connect', ['lab'], function(){
|
84
|
+
browserSync.init({
|
85
|
+
server: {
|
86
|
+
baseDir: './public/'
|
87
|
+
}
|
88
|
+
});
|
89
|
+
gulp.watch('./source/css/shibori.css', ['cp:css']);
|
90
|
+
|
91
|
+
//suggested watches if you use scss
|
92
|
+
gulp.watch('./source/css/**/*.scss', ['sass:style']);
|
93
|
+
gulp.watch('./public/styleguide/css/*.scss', ['sass:styleguide']);
|
94
|
+
|
95
|
+
gulp.watch([
|
96
|
+
'./source/_patterns/**/*.mustache',
|
97
|
+
'./source/_patterns/**/*.json',
|
98
|
+
'./source/_data/*.json' ],
|
99
|
+
['lab-pipe'], function(){
|
100
|
+
browserSync.reload();
|
101
|
+
});
|
102
|
+
|
103
|
+
})
|
104
|
+
|
105
|
+
//unit test
|
106
|
+
gulp.task('nodeunit', function(){
|
107
|
+
return gulp.src('./test/**/*_tests.js')
|
108
|
+
.pipe(nodeunit());
|
109
|
+
})
|
110
|
+
|
111
|
+
// sass tasks, turn on if you want to use
|
112
|
+
gulp.task('sass:style', function(){
|
113
|
+
return gulp.src('./source/css/*.scss')
|
114
|
+
.pipe(sass({
|
115
|
+
outputStyle: 'expanded',
|
116
|
+
precision: 8,
|
117
|
+
includePaths: neat.includePaths
|
118
|
+
}))
|
119
|
+
.pipe(gulp.dest('./public/css'))
|
120
|
+
.pipe(browserSync.stream());
|
121
|
+
})
|
122
|
+
gulp.task('sass:styleguide', function(){
|
123
|
+
return gulp.src('./public/styleguide/css/*.scss')
|
124
|
+
.pipe(sass({
|
125
|
+
outputStyle: 'expanded',
|
126
|
+
precision: 8
|
127
|
+
}))
|
128
|
+
.pipe(gulp.dest('./public/styleguide/css'))
|
129
|
+
.pipe(browserSync.stream());
|
130
|
+
})
|
131
|
+
|
132
|
+
gulp.task('lab-pipe', ['lab'], function(cb){
|
133
|
+
cb();
|
134
|
+
browserSync.reload();
|
135
|
+
})
|
136
|
+
|
137
|
+
gulp.task('default', ['lab']);
|
138
|
+
|
139
|
+
gulp.task('assets', ['cp:js', 'cp:img', 'cp:font', 'cp:data', 'sass:style', 'sass:styleguide']);
|
140
|
+
gulp.task('prelab', ['clean', 'banner', 'assets']);
|
141
|
+
gulp.task('lab', ['prelab', 'patternlab'], function(cb){cb();});
|
142
|
+
gulp.task('patterns', ['patternlab:only_patterns']);
|
143
|
+
gulp.task('serve', ['lab', 'connect']);
|
144
|
+
gulp.task('serveprod', ['lab']);
|
145
|
+
gulp.task('travis', ['lab', 'nodeunit']);
|
146
|
+
|
147
|
+
gulp.task('version', ['patternlab:version']);
|
148
|
+
gulp.task('help', ['patternlab:help']);
|
data/index.js
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
var express = require('express');
|
2
|
+
var app = express();
|
3
|
+
|
4
|
+
app.set('port', (process.env.PORT || 5000));
|
5
|
+
|
6
|
+
app.use(express.static(__dirname + '/public'));
|
7
|
+
|
8
|
+
// views is directory for all template files
|
9
|
+
app.set('views', __dirname + '/public');
|
10
|
+
app.set('view engine', 'ejs');
|
11
|
+
|
12
|
+
app.get('/', function(request, response) {
|
13
|
+
response.render('index');
|
14
|
+
});
|
15
|
+
|
16
|
+
app.listen(app.get('port'), function() {
|
17
|
+
console.log('Node app is running on port', app.get('port'));
|
18
|
+
});
|
19
|
+
|
20
|
+
|
data/lib/shibori.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
class Shibori
|
2
|
+
class Railtie < Rails::Railtie
|
3
|
+
initializer 'shibori' do
|
4
|
+
Rails.configuration.assets.paths += [
|
5
|
+
File.expand_path('../../source/css', __FILE__),
|
6
|
+
File.expand_path('../../source/js', __FILE__),
|
7
|
+
File.expand_path('../../source/fonts', __FILE__),
|
8
|
+
]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/package.json
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
{
|
2
|
+
"name": "Heroku-Patterns",
|
3
|
+
"description": "Pattern Lab is a collection of tools to help you create atomic design systems. This is the node command line interface (CLI).",
|
4
|
+
"version": "0.2.0",
|
5
|
+
"scripts": {
|
6
|
+
"start": "node index.js",
|
7
|
+
"postinstall": "gulp default"
|
8
|
+
},
|
9
|
+
"dependencies": {
|
10
|
+
"browser-sync": "^2.8.2",
|
11
|
+
"del": "^1.2.1",
|
12
|
+
"diveSync": "^0.2.1",
|
13
|
+
"ejs": "2.3.3",
|
14
|
+
"express": "^4.13.3",
|
15
|
+
"fs-extra": "^0.14.0",
|
16
|
+
"glob": "^4.3.5",
|
17
|
+
"gulp": "^3.8.8",
|
18
|
+
"gulp-copy": "0.0.2",
|
19
|
+
"gulp-header": "^1.0.5",
|
20
|
+
"gulp-load": "^0.1.1",
|
21
|
+
"gulp-nodeunit": "0.0.5",
|
22
|
+
"gulp-sass": "^2.0.4",
|
23
|
+
"gulp-strip-banner": "0.0.2",
|
24
|
+
"html-entities": "^1.1.1",
|
25
|
+
"mustache": "^1.0.0",
|
26
|
+
"node-bourbon": "^4.2.3",
|
27
|
+
"node-neat": "^1.7.2",
|
28
|
+
"owl.carousel": "^2.1.4"
|
29
|
+
},
|
30
|
+
"keywords": [
|
31
|
+
"Pattern Lab",
|
32
|
+
"Atomic Web Design",
|
33
|
+
"Node",
|
34
|
+
"Grunt",
|
35
|
+
"Javascript"
|
36
|
+
],
|
37
|
+
"repository": {
|
38
|
+
"type": "git",
|
39
|
+
"url": "git://github.com/heroku/www-patterns.git"
|
40
|
+
},
|
41
|
+
"engines": {
|
42
|
+
"node": ">=0.1"
|
43
|
+
}
|
44
|
+
}
|