shibori 1.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,258 @@
|
|
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 pattern_assembler = function(){
|
13
|
+
|
14
|
+
function isObjectEmpty(obj) {
|
15
|
+
for(var prop in obj) {
|
16
|
+
if(obj.hasOwnProperty(prop))
|
17
|
+
return false;
|
18
|
+
}
|
19
|
+
|
20
|
+
return true;
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
//find and return any {{> template-name }} within pattern
|
25
|
+
function findPartials(pattern){
|
26
|
+
var matches = pattern.template.match(/{{>([ ])?([\w\-\.\/~]+)(?:\:[A-Za-z0-9-]+)?(?:(| )\(.*)?([ ])?}}/g);
|
27
|
+
return matches;
|
28
|
+
}
|
29
|
+
|
30
|
+
function findListItems(pattern){
|
31
|
+
var matches = pattern.template.match(/({{#( )?)(listItems.)(one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty)( )?}}/g);
|
32
|
+
return matches;
|
33
|
+
}
|
34
|
+
|
35
|
+
function setState(pattern, patternlab){
|
36
|
+
if(patternlab.config.patternStates[pattern.patternName]){
|
37
|
+
pattern.patternState = patternlab.config.patternStates[pattern.patternName];
|
38
|
+
} else{
|
39
|
+
pattern.patternState = "";
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
function addPattern(pattern, patternlab){
|
44
|
+
patternlab.data.link[pattern.patternGroup + '-' + pattern.patternName] = '/patterns/' + pattern.patternLink;
|
45
|
+
patternlab.patterns.push(pattern);
|
46
|
+
}
|
47
|
+
|
48
|
+
function renderPattern(template, data, partials) {
|
49
|
+
|
50
|
+
var mustache = require('mustache');
|
51
|
+
|
52
|
+
if(partials) {
|
53
|
+
return mustache.render(template, data, partials);
|
54
|
+
} else{
|
55
|
+
return mustache.render(template, data);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
function processPatternFile(file, patternlab){
|
60
|
+
var fs = require('fs-extra'),
|
61
|
+
of = require('./object_factory'),
|
62
|
+
path = require('path');
|
63
|
+
|
64
|
+
//extract some information
|
65
|
+
var abspath = file.substring(2);
|
66
|
+
var subdir = path.dirname(path.relative(patternlab.config.patterns.source, file)).replace('\\', '/');
|
67
|
+
var filename = path.basename(file);
|
68
|
+
|
69
|
+
//ignore _underscored patterns, json (for now), and dotfiles
|
70
|
+
if(filename.charAt(0) === '_' || path.extname(filename) === '.json' || filename.charAt(0) === '.'){
|
71
|
+
return;
|
72
|
+
}
|
73
|
+
|
74
|
+
//make a new Pattern Object
|
75
|
+
var currentPattern = new of.oPattern(subdir, filename);
|
76
|
+
|
77
|
+
//see if this file has a state
|
78
|
+
setState(currentPattern, patternlab);
|
79
|
+
|
80
|
+
//look for a json file for this template
|
81
|
+
try {
|
82
|
+
var jsonFilename = patternlab.config.patterns.source + currentPattern.subdir + '/' + currentPattern.fileName + ".json";
|
83
|
+
currentPattern.jsonFileData = fs.readJSONSync(jsonFilename.substring(2));
|
84
|
+
console.log('found pattern-specific data.json for ' + currentPattern.key);
|
85
|
+
}
|
86
|
+
catch(e) {
|
87
|
+
}
|
88
|
+
|
89
|
+
//look for a listitems.json file for this template
|
90
|
+
try {
|
91
|
+
var listJsonFileName = patternlab.config.patterns.source + currentPattern.subdir + '/' + currentPattern.fileName + ".listitems.json";
|
92
|
+
currentPattern.patternSpecificListJson = fs.readJSONSync(listJsonFileName.substring(2));
|
93
|
+
console.log('found pattern-specific listitems.json for ' + currentPattern.key);
|
94
|
+
}
|
95
|
+
catch(e) {
|
96
|
+
}
|
97
|
+
|
98
|
+
//add the raw template to memory
|
99
|
+
currentPattern.template = fs.readFileSync(abspath, 'utf8');
|
100
|
+
|
101
|
+
//our helper function that does a lot of heavy lifting
|
102
|
+
processPattern(currentPattern, patternlab);
|
103
|
+
}
|
104
|
+
|
105
|
+
function processPattern(currentPattern, patternlab, additionalData){
|
106
|
+
|
107
|
+
var fs = require('fs-extra'),
|
108
|
+
mustache = require('mustache'),
|
109
|
+
lh = require('./lineage_hunter'),
|
110
|
+
ph = require('./parameter_hunter'),
|
111
|
+
pph = require('./pseudopattern_hunter'),
|
112
|
+
lih = require('./list_item_hunter'),
|
113
|
+
path = require('path');
|
114
|
+
|
115
|
+
var parameter_hunter = new ph(),
|
116
|
+
lineage_hunter = new lh(),
|
117
|
+
list_item_hunter = new lih(),
|
118
|
+
pseudopattern_hunter = new pph();
|
119
|
+
|
120
|
+
currentPattern.extendedTemplate = currentPattern.template;
|
121
|
+
|
122
|
+
//find how many partials there may be for the given pattern
|
123
|
+
var foundPatternPartials = findPartials(currentPattern);
|
124
|
+
|
125
|
+
if(foundPatternPartials !== null && foundPatternPartials.length > 0){
|
126
|
+
|
127
|
+
if(patternlab.config.debug){
|
128
|
+
console.log('found partials for ' + currentPattern.key);
|
129
|
+
}
|
130
|
+
|
131
|
+
//find any listItem partials
|
132
|
+
list_item_hunter.process_list_item_partials(currentPattern, patternlab);
|
133
|
+
|
134
|
+
//determine if the template contains any pattern parameters. if so they must be immediately consumed
|
135
|
+
parameter_hunter.find_parameters(currentPattern, patternlab);
|
136
|
+
|
137
|
+
//do something with the regular old partials
|
138
|
+
for(var i = 0; i < foundPatternPartials.length; i++){
|
139
|
+
var partialKey = foundPatternPartials[i].replace(/{{>([ ])?([\w\-\.\/~]+)(?:\:[A-Za-z0-9-]+)?(?:(| )\(.*)?([ ])?}}/g, '$2');
|
140
|
+
var partialPattern = getpatternbykey(partialKey, patternlab);
|
141
|
+
currentPattern.extendedTemplate = currentPattern.extendedTemplate.replace(foundPatternPartials[i], partialPattern.extendedTemplate);
|
142
|
+
}
|
143
|
+
|
144
|
+
}
|
145
|
+
|
146
|
+
//find pattern lineage
|
147
|
+
lineage_hunter.find_lineage(currentPattern, patternlab);
|
148
|
+
|
149
|
+
//look for a pseudo pattern by checking if there is a file containing same name, with ~ in it, ending in .json
|
150
|
+
pseudopattern_hunter.find_pseudopatterns(currentPattern, patternlab);
|
151
|
+
|
152
|
+
//add to patternlab object so we can look these up later.
|
153
|
+
addPattern(currentPattern, patternlab);
|
154
|
+
}
|
155
|
+
|
156
|
+
function getpatternbykey(key, patternlab){
|
157
|
+
for(var i = 0; i < patternlab.patterns.length; i++){
|
158
|
+
switch(key){
|
159
|
+
case patternlab.patterns[i].key:
|
160
|
+
case patternlab.patterns[i].subdir + '/' + patternlab.patterns[i].fileName:
|
161
|
+
case patternlab.patterns[i].subdir + '/' + patternlab.patterns[i].fileName + '.mustache':
|
162
|
+
return patternlab.patterns[i];
|
163
|
+
}
|
164
|
+
}
|
165
|
+
throw 'Could not find pattern with key ' + key;
|
166
|
+
}
|
167
|
+
|
168
|
+
|
169
|
+
var self = this;
|
170
|
+
function mergeData(obj1, obj2) {
|
171
|
+
for (var p in obj2) {
|
172
|
+
try {
|
173
|
+
// Property in destination object set; update its value.
|
174
|
+
if ( obj2[p].constructor == Object ) {
|
175
|
+
obj1[p] = self.merge_data(obj1[p], obj2[p]);
|
176
|
+
|
177
|
+
} else {
|
178
|
+
obj1[p] = obj2[p];
|
179
|
+
}
|
180
|
+
} catch(e) {
|
181
|
+
// Property in destination object not set; create it and set its value.
|
182
|
+
obj1[p] = obj2[p];
|
183
|
+
}
|
184
|
+
}
|
185
|
+
return obj1;
|
186
|
+
}
|
187
|
+
|
188
|
+
function buildListItems(patternlab){
|
189
|
+
//combine all list items into one structure
|
190
|
+
var list = [];
|
191
|
+
for (var item in patternlab.listitems) {
|
192
|
+
if( patternlab.listitems.hasOwnProperty(item)) {
|
193
|
+
list.push(patternlab.listitems[item]);
|
194
|
+
}
|
195
|
+
}
|
196
|
+
patternlab.listItemArray = shuffle(list);
|
197
|
+
|
198
|
+
for(var i = 1; i <= patternlab.listItemArray.length; i++){
|
199
|
+
var tempItems = [];
|
200
|
+
if( i === 1){
|
201
|
+
tempItems.push(patternlab.listItemArray[0]);
|
202
|
+
patternlab.listitems['' + i ] = tempItems;
|
203
|
+
} else{
|
204
|
+
for(var c = 1; c <= i; c++){
|
205
|
+
tempItems.push(patternlab.listItemArray[c - 1]);
|
206
|
+
patternlab.listitems['' + i ] = tempItems;
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
//http://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array-in-javascript
|
213
|
+
function shuffle(o){
|
214
|
+
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
|
215
|
+
return o;
|
216
|
+
}
|
217
|
+
|
218
|
+
return {
|
219
|
+
find_pattern_partials: function(pattern){
|
220
|
+
return findPartials(pattern);
|
221
|
+
},
|
222
|
+
find_list_items: function(pattern){
|
223
|
+
return findListItems(pattern)
|
224
|
+
},
|
225
|
+
setPatternState: function(pattern, patternlab){
|
226
|
+
setState(pattern, patternlab);
|
227
|
+
},
|
228
|
+
addPattern: function(pattern, patternlab){
|
229
|
+
addPattern(pattern, patternlab);
|
230
|
+
},
|
231
|
+
renderPattern: function(template, data, partials){
|
232
|
+
return renderPattern(template, data, partials);
|
233
|
+
},
|
234
|
+
process_pattern_file: function(file, patternlab){
|
235
|
+
processPatternFile(file, patternlab);
|
236
|
+
},
|
237
|
+
process_pattern: function(pattern, patternlab, additionalData){
|
238
|
+
processPattern(pattern, patternlab, additionalData);
|
239
|
+
},
|
240
|
+
get_pattern_by_key: function(key, patternlab){
|
241
|
+
return getpatternbykey(key, patternlab);
|
242
|
+
},
|
243
|
+
merge_data: function(existingData, newData){
|
244
|
+
return mergeData(existingData, newData);
|
245
|
+
},
|
246
|
+
combine_listItems: function(patternlab){
|
247
|
+
buildListItems(patternlab);
|
248
|
+
},
|
249
|
+
is_object_empty: function(obj){
|
250
|
+
return isObjectEmpty(obj);
|
251
|
+
}
|
252
|
+
};
|
253
|
+
|
254
|
+
};
|
255
|
+
|
256
|
+
module.exports = pattern_assembler;
|
257
|
+
|
258
|
+
}());
|
@@ -0,0 +1,43 @@
|
|
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 fs = require('fs-extra'),
|
13
|
+
path = require('path');
|
14
|
+
|
15
|
+
var pattern_exporter = function(){
|
16
|
+
|
17
|
+
function exportPatterns(patternlab){
|
18
|
+
|
19
|
+
//read the config export options
|
20
|
+
var exportKeys = patternlab.config.patternExportKeys;
|
21
|
+
|
22
|
+
//find the chosen patterns to export
|
23
|
+
for (var i = 0; i < exportKeys.length; i++){
|
24
|
+
for (var j = 0; j < patternlab.patterns.length; j++){
|
25
|
+
if(exportKeys[i] === patternlab.patterns[j].key){
|
26
|
+
//write matches to the desired location
|
27
|
+
fs.outputFileSync(patternlab.config.patternExportDirectory + patternlab.patterns[j].key + '.html', patternlab.patterns[j].patternPartial);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
return {
|
34
|
+
export_patterns: function(patternlab){
|
35
|
+
exportPatterns(patternlab);
|
36
|
+
}
|
37
|
+
};
|
38
|
+
|
39
|
+
};
|
40
|
+
|
41
|
+
module.exports = pattern_exporter;
|
42
|
+
|
43
|
+
}());
|
@@ -0,0 +1,365 @@
|
|
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
|
+
**/var patternlab_engine = function () {
|
10
|
+
'use strict';
|
11
|
+
|
12
|
+
var path = require('path'),
|
13
|
+
fs = require('fs-extra'),
|
14
|
+
extend = require('util')._extend,
|
15
|
+
diveSync = require('diveSync'),
|
16
|
+
mustache = require('mustache'),
|
17
|
+
glob = require('glob'),
|
18
|
+
of = require('./object_factory'),
|
19
|
+
pa = require('./pattern_assembler'),
|
20
|
+
mh = require('./media_hunter'),
|
21
|
+
pe = require('./pattern_exporter'),
|
22
|
+
he = require('html-entities').AllHtmlEntities,
|
23
|
+
patternlab = {};
|
24
|
+
|
25
|
+
patternlab.package = fs.readJSONSync('./package.json');
|
26
|
+
patternlab.config = fs.readJSONSync('./config.json');
|
27
|
+
|
28
|
+
function getVersion() {
|
29
|
+
console.log(patternlab.package.version);
|
30
|
+
}
|
31
|
+
|
32
|
+
function help(){
|
33
|
+
console.log('Patternlab Node Help');
|
34
|
+
console.log('===============================');
|
35
|
+
console.log('Command Line Arguments');
|
36
|
+
console.log('patternlab:only_patterns');
|
37
|
+
console.log(' > Compiles the patterns only, outputting to config.patterns.public');
|
38
|
+
console.log('patternlab:v');
|
39
|
+
console.log(' > Retrieve the version of patternlab-node you have installed');
|
40
|
+
console.log('patternlab:help');
|
41
|
+
console.log(' > Get more information about patternlab-node, pattern lab in general, and where to report issues.');
|
42
|
+
console.log('===============================');
|
43
|
+
console.log('Visit http://patternlab.io/docs/index.html for general help on pattern-lab');
|
44
|
+
console.log('Visit https://github.com/pattern-lab/patternlab-node/issues to open a bug.');
|
45
|
+
}
|
46
|
+
|
47
|
+
function printDebug() {
|
48
|
+
//debug file can be written by setting flag on config.json
|
49
|
+
if(patternlab.config.debug){
|
50
|
+
console.log('writing patternlab debug file to ./patternlab.json');
|
51
|
+
fs.outputFileSync('./patternlab.json', JSON.stringify(patternlab, null, 3));
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
function buildPatterns(deletePatternDir){
|
56
|
+
patternlab.data = fs.readJSONSync('./source/_data/data.json');
|
57
|
+
patternlab.listitems = fs.readJSONSync('./source/_data/listitems.json');
|
58
|
+
patternlab.header = fs.readFileSync('./source/_patternlab-files/pattern-header-footer/header.html', 'utf8');
|
59
|
+
patternlab.footer = fs.readFileSync('./source/_patternlab-files/pattern-header-footer/footer.html', 'utf8');
|
60
|
+
patternlab.patterns = [];
|
61
|
+
patternlab.partials = {};
|
62
|
+
patternlab.data.link = {};
|
63
|
+
|
64
|
+
var pattern_assembler = new pa(),
|
65
|
+
entity_encoder = new he(),
|
66
|
+
pattern_exporter = new pe(),
|
67
|
+
patterns_dir = './source/_patterns';
|
68
|
+
|
69
|
+
pattern_assembler.combine_listItems(patternlab);
|
70
|
+
|
71
|
+
diveSync(patterns_dir, {
|
72
|
+
filter: function(path, dir) {
|
73
|
+
if(dir){
|
74
|
+
var remainingPath = path.replace(patterns_dir, '');
|
75
|
+
var isValidPath = remainingPath.indexOf('/_') === -1;
|
76
|
+
return isValidPath;
|
77
|
+
}
|
78
|
+
return true;
|
79
|
+
}
|
80
|
+
},
|
81
|
+
function(err, file){
|
82
|
+
//log any errors
|
83
|
+
if(err){
|
84
|
+
console.log(err);
|
85
|
+
return;
|
86
|
+
}
|
87
|
+
|
88
|
+
pattern_assembler.process_pattern_file(file, patternlab);
|
89
|
+
});
|
90
|
+
|
91
|
+
//delete the contents of config.patterns.public before writing
|
92
|
+
if(deletePatternDir){
|
93
|
+
fs.emptyDirSync(patternlab.config.patterns.public);
|
94
|
+
}
|
95
|
+
|
96
|
+
//render all patterns last, so lineageR works
|
97
|
+
patternlab.patterns.forEach(function(pattern, index, patterns){
|
98
|
+
//render the pattern, but first consolidate any data we may have
|
99
|
+
var allData = JSON.parse(JSON.stringify(patternlab.data));
|
100
|
+
allData = pattern_assembler.merge_data(allData, pattern.jsonFileData);
|
101
|
+
|
102
|
+
pattern.patternPartial = pattern_assembler.renderPattern(pattern.extendedTemplate, allData);
|
103
|
+
|
104
|
+
//add footer info before writing
|
105
|
+
var patternFooter = pattern_assembler.renderPattern(patternlab.footer, pattern);
|
106
|
+
|
107
|
+
//write the compiled template to the public patterns directory
|
108
|
+
fs.outputFileSync(patternlab.config.patterns.public + pattern.patternLink, patternlab.header + pattern.patternPartial + patternFooter);
|
109
|
+
|
110
|
+
//write the mustache file too
|
111
|
+
fs.outputFileSync(patternlab.config.patterns.public + pattern.patternLink.replace('.html', '.mustache'), entity_encoder.encode(pattern.template));
|
112
|
+
|
113
|
+
//write the encoded version too
|
114
|
+
fs.outputFileSync(patternlab.config.patterns.public + pattern.patternLink.replace('.html', '.escaped.html'), entity_encoder.encode(pattern.patternPartial));
|
115
|
+
});
|
116
|
+
|
117
|
+
//export patterns if necessary
|
118
|
+
pattern_exporter.export_patterns(patternlab);
|
119
|
+
|
120
|
+
}
|
121
|
+
|
122
|
+
function buildFrontEnd(){
|
123
|
+
var pattern_assembler = new pa(),
|
124
|
+
media_hunter = new mh();
|
125
|
+
patternlab.buckets = [];
|
126
|
+
patternlab.bucketIndex = [];
|
127
|
+
patternlab.patternPaths = {};
|
128
|
+
patternlab.viewAllPaths = {};
|
129
|
+
|
130
|
+
//find mediaQueries
|
131
|
+
media_hunter.find_media_queries('./source/css', patternlab);
|
132
|
+
|
133
|
+
//build the styleguide
|
134
|
+
var styleguideTemplate = fs.readFileSync('./source/_patternlab-files/styleguide.mustache', 'utf8'),
|
135
|
+
styleguideHtml = pattern_assembler.renderPattern(styleguideTemplate, {partials: patternlab.patterns});
|
136
|
+
fs.outputFileSync('./public/styleguide/html/styleguide.html', styleguideHtml);
|
137
|
+
|
138
|
+
//build the viewall pages
|
139
|
+
var prevSubdir = '',
|
140
|
+
i;
|
141
|
+
|
142
|
+
for (i = 0; i < patternlab.patterns.length; i++) {
|
143
|
+
var pattern = patternlab.patterns[i];
|
144
|
+
|
145
|
+
// check if the current sub section is different from the previous one
|
146
|
+
if (pattern.subdir !== prevSubdir) {
|
147
|
+
prevSubdir = pattern.subdir;
|
148
|
+
|
149
|
+
var viewAllPatterns = [],
|
150
|
+
patternPartial = "viewall-" + pattern.patternGroup + "-" + pattern.patternSubGroup,
|
151
|
+
j;
|
152
|
+
|
153
|
+
for (j = 0; j < patternlab.patterns.length; j++) {
|
154
|
+
if (patternlab.patterns[j].subdir === pattern.subdir) {
|
155
|
+
viewAllPatterns.push(patternlab.patterns[j]);
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
var viewAllTemplate = fs.readFileSync('./source/_patternlab-files/viewall.mustache', 'utf8');
|
160
|
+
var viewAllHtml = pattern_assembler.renderPattern(viewAllTemplate, {partials: viewAllPatterns, patternPartial: patternPartial});
|
161
|
+
fs.outputFileSync(patternlab.config.patterns.public + pattern.flatPatternPath + '/index.html', viewAllHtml);
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
//build the patternlab website
|
166
|
+
var patternlabSiteTemplate = fs.readFileSync('./source/_patternlab-files/index.mustache', 'utf8');
|
167
|
+
|
168
|
+
//loop through all patterns.to build the navigation
|
169
|
+
//todo: refactor this someday
|
170
|
+
for(var i = 0; i < patternlab.patterns.length; i++){
|
171
|
+
var pattern = patternlab.patterns[i];
|
172
|
+
var bucketName = pattern.name.replace(/\\/g, '-').split('-')[1];
|
173
|
+
|
174
|
+
//check if the bucket already exists
|
175
|
+
var bucketIndex = patternlab.bucketIndex.indexOf(bucketName);
|
176
|
+
if(bucketIndex === -1){
|
177
|
+
//add the bucket
|
178
|
+
var bucket = new of.oBucket(bucketName);
|
179
|
+
|
180
|
+
//add patternPath and viewAllPath
|
181
|
+
patternlab.patternPaths[bucketName] = {};
|
182
|
+
patternlab.viewAllPaths[bucketName] = {};
|
183
|
+
|
184
|
+
//get the navItem
|
185
|
+
var navItemName = pattern.subdir.split('-').pop();
|
186
|
+
|
187
|
+
//get the navSubItem
|
188
|
+
var navSubItemName = pattern.patternName.replace(/-/g, ' ');
|
189
|
+
|
190
|
+
//test whether the pattern struture is flat or not - usually due to a template or page
|
191
|
+
var flatPatternItem = false;
|
192
|
+
if(navItemName === bucketName){
|
193
|
+
flatPatternItem = true;
|
194
|
+
}
|
195
|
+
|
196
|
+
//assume the navItem does not exist.
|
197
|
+
var navItem = new of.oNavItem(navItemName);
|
198
|
+
|
199
|
+
//assume the navSubItem does not exist.
|
200
|
+
var navSubItem = new of.oNavSubItem(navSubItemName);
|
201
|
+
navSubItem.patternPath = pattern.patternLink;
|
202
|
+
navSubItem.patternPartial = bucketName + "-" + pattern.patternName; //add the hyphenated name
|
203
|
+
|
204
|
+
//add the patternState if it exists
|
205
|
+
if(pattern.patternState){
|
206
|
+
navSubItem.patternState = pattern.patternState;
|
207
|
+
}
|
208
|
+
|
209
|
+
//if it is flat - we should not add the pattern to patternPaths
|
210
|
+
if(flatPatternItem){
|
211
|
+
|
212
|
+
bucket.patternItems.push(navSubItem);
|
213
|
+
|
214
|
+
//add to patternPaths
|
215
|
+
addToPatternPaths(bucketName, pattern);
|
216
|
+
|
217
|
+
} else{
|
218
|
+
|
219
|
+
bucket.navItems.push(navItem);
|
220
|
+
bucket.navItemsIndex.push(navItemName);
|
221
|
+
navItem.navSubItems.push(navSubItem);
|
222
|
+
navItem.navSubItemsIndex.push(navSubItemName);
|
223
|
+
|
224
|
+
//add to patternPaths
|
225
|
+
addToPatternPaths(bucketName, pattern);
|
226
|
+
|
227
|
+
}
|
228
|
+
|
229
|
+
//add the bucket.
|
230
|
+
patternlab.buckets.push(bucket);
|
231
|
+
patternlab.bucketIndex.push(bucketName);
|
232
|
+
|
233
|
+
//done
|
234
|
+
|
235
|
+
} else{
|
236
|
+
//find the bucket
|
237
|
+
var bucket = patternlab.buckets[bucketIndex];
|
238
|
+
|
239
|
+
//get the navItem
|
240
|
+
var navItemName = pattern.subdir.split('-').pop();
|
241
|
+
|
242
|
+
//get the navSubItem
|
243
|
+
var navSubItemName = pattern.patternName.replace(/-/g, ' ');
|
244
|
+
|
245
|
+
//assume the navSubItem does not exist.
|
246
|
+
var navSubItem = new of.oNavSubItem(navSubItemName);
|
247
|
+
navSubItem.patternPath = pattern.patternLink;
|
248
|
+
navSubItem.patternPartial = bucketName + "-" + pattern.patternName; //add the hyphenated name
|
249
|
+
|
250
|
+
//add the patternState if it exists
|
251
|
+
if(pattern.patternState){
|
252
|
+
navSubItem.patternState = pattern.patternState;
|
253
|
+
}
|
254
|
+
|
255
|
+
//test whether the pattern struture is flat or not - usually due to a template or page
|
256
|
+
var flatPatternItem = false;
|
257
|
+
if(navItemName === bucketName){
|
258
|
+
flatPatternItem = true;
|
259
|
+
}
|
260
|
+
|
261
|
+
//if it is flat - we should not add the pattern to patternPaths
|
262
|
+
if(flatPatternItem){
|
263
|
+
|
264
|
+
//add the navItem to patternItems
|
265
|
+
bucket.patternItems.push(navSubItem);
|
266
|
+
|
267
|
+
//add to patternPaths
|
268
|
+
addToPatternPaths(bucketName, pattern);
|
269
|
+
|
270
|
+
} else{
|
271
|
+
//check to see if navItem exists
|
272
|
+
var navItemIndex = bucket.navItemsIndex.indexOf(navItemName);
|
273
|
+
if(navItemIndex === -1){
|
274
|
+
|
275
|
+
var navItem = new of.oNavItem(navItemName);
|
276
|
+
|
277
|
+
//add the navItem and navSubItem
|
278
|
+
navItem.navSubItems.push(navSubItem);
|
279
|
+
navItem.navSubItemsIndex.push(navSubItemName);
|
280
|
+
bucket.navItems.push(navItem);
|
281
|
+
bucket.navItemsIndex.push(navItemName);
|
282
|
+
|
283
|
+
} else{
|
284
|
+
//add the navSubItem
|
285
|
+
var navItem = bucket.navItems[navItemIndex];
|
286
|
+
navItem.navSubItems.push(navSubItem);
|
287
|
+
navItem.navSubItemsIndex.push(navSubItemName);
|
288
|
+
}
|
289
|
+
|
290
|
+
//add the navViewAllSubItem
|
291
|
+
var navViewAllSubItem = new of.oNavSubItem("");
|
292
|
+
navViewAllSubItem.patternName = "View All";
|
293
|
+
navViewAllSubItem.patternPath = pattern.flatPatternPath + "/index.html";
|
294
|
+
navViewAllSubItem.patternPartial = "viewall-" + pattern.patternGroup + "-" + pattern.patternSubGroup;
|
295
|
+
|
296
|
+
//check if we are moving to a new sub section in the next loop
|
297
|
+
if (!patternlab.patterns[i + 1] || pattern.patternSubGroup !== patternlab.patterns[i + 1].patternSubGroup) {
|
298
|
+
navItem.navSubItems.push(navViewAllSubItem);
|
299
|
+
navItem.navSubItemsIndex.push("View All");
|
300
|
+
}
|
301
|
+
|
302
|
+
// just add to patternPaths
|
303
|
+
addToPatternPaths(bucketName, pattern);
|
304
|
+
}
|
305
|
+
|
306
|
+
}
|
307
|
+
|
308
|
+
patternlab.viewAllPaths[bucketName][pattern.patternSubGroup] = pattern.flatPatternPath;
|
309
|
+
|
310
|
+
}
|
311
|
+
|
312
|
+
//the patternlab site requires a lot of partials to be rendered.
|
313
|
+
//patternNav
|
314
|
+
var patternNavTemplate = fs.readFileSync('./source/_patternlab-files/partials/patternNav.mustache', 'utf8');
|
315
|
+
var patternNavPartialHtml = pattern_assembler.renderPattern(patternNavTemplate, patternlab);
|
316
|
+
|
317
|
+
//ishControls
|
318
|
+
var ishControlsTemplate = fs.readFileSync('./source/_patternlab-files/partials/ishControls.mustache', 'utf8');
|
319
|
+
patternlab.config.mqs = patternlab.mediaQueries;
|
320
|
+
var ishControlsPartialHtml = pattern_assembler.renderPattern(ishControlsTemplate, patternlab.config);
|
321
|
+
|
322
|
+
//patternPaths
|
323
|
+
var patternPathsTemplate = fs.readFileSync('./source/_patternlab-files/partials/patternPaths.mustache', 'utf8');
|
324
|
+
var patternPathsPartialHtml = pattern_assembler.renderPattern(patternPathsTemplate, {'patternPaths': JSON.stringify(patternlab.patternPaths)});
|
325
|
+
|
326
|
+
//viewAllPaths
|
327
|
+
var viewAllPathsTemplate = fs.readFileSync('./source/_patternlab-files/partials/viewAllPaths.mustache', 'utf8');
|
328
|
+
var viewAllPathsPartialHtml = pattern_assembler.renderPattern(viewAllPathsTemplate, {'viewallpaths': JSON.stringify(patternlab.viewAllPaths)});
|
329
|
+
|
330
|
+
//render the patternlab template, with all partials
|
331
|
+
var patternlabSiteHtml = pattern_assembler.renderPattern(patternlabSiteTemplate, {}, {
|
332
|
+
'ishControls': ishControlsPartialHtml,
|
333
|
+
'patternNav': patternNavPartialHtml,
|
334
|
+
'patternPaths': patternPathsPartialHtml,
|
335
|
+
'viewAllPaths': viewAllPathsPartialHtml
|
336
|
+
});
|
337
|
+
fs.outputFileSync('./public/index.html', patternlabSiteHtml);
|
338
|
+
}
|
339
|
+
|
340
|
+
function addToPatternPaths(bucketName, pattern){
|
341
|
+
//this is messy, could use a refactor.
|
342
|
+
patternlab.patternPaths[bucketName][pattern.patternName] = pattern.subdir.replace(/\\/g, '/') + "/" + pattern.fileName;
|
343
|
+
}
|
344
|
+
|
345
|
+
return {
|
346
|
+
version: function(){
|
347
|
+
return getVersion();
|
348
|
+
},
|
349
|
+
build: function(deletePatternDir){
|
350
|
+
buildPatterns(deletePatternDir);
|
351
|
+
buildFrontEnd();
|
352
|
+
printDebug();
|
353
|
+
},
|
354
|
+
help: function(){
|
355
|
+
help();
|
356
|
+
},
|
357
|
+
build_patterns_only: function(deletePatternDir){
|
358
|
+
buildPatterns(deletePatternDir);
|
359
|
+
printDebug();
|
360
|
+
}
|
361
|
+
};
|
362
|
+
|
363
|
+
};
|
364
|
+
|
365
|
+
module.exports = patternlab_engine;
|
@@ -0,0 +1,38 @@
|
|
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
|
+
**/var patternlab_engine = require('./patternlab.js');
|
10
|
+
|
11
|
+
module.exports = function(grunt) {
|
12
|
+
grunt.registerTask('patternlab', 'create design systems with atomic design', function(arg) {
|
13
|
+
|
14
|
+
var patternlab = patternlab_engine();
|
15
|
+
|
16
|
+
if(arguments.length === 0){
|
17
|
+
patternlab.build(true);
|
18
|
+
}
|
19
|
+
|
20
|
+
if(arg && arg === 'v'){
|
21
|
+
patternlab.version();
|
22
|
+
}
|
23
|
+
|
24
|
+
if(arg && arg === "only_patterns"){
|
25
|
+
patternlab.build_patterns_only(true);
|
26
|
+
}
|
27
|
+
|
28
|
+
if(arg && arg === "help"){
|
29
|
+
patternlab.help();
|
30
|
+
}
|
31
|
+
|
32
|
+
if(arg && (arg !== "v" && arg !=="only_patterns" && arg !=="help")){
|
33
|
+
patternlab.help();
|
34
|
+
}
|
35
|
+
|
36
|
+
});
|
37
|
+
|
38
|
+
};
|