Skip to content
This repository was archived by the owner on Dec 10, 2019. It is now read-only.

Commit b5622af

Browse files
committed
move source/_patternlab-files/partials to core/templates
move source/_patternlab-files/pattern-header-footer to core/source/_meta updated config entries #133
1 parent 211b233 commit b5622af

14 files changed

+104
-17
lines changed

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"patterns" : "./source/_patterns/",
66
"data" : "./source/_data/",
77
"styleguide" : "./core/styleguide/",
8-
"patternlabFiles" : "./source/_patternlab-files/",
8+
"patternlabFiles" : "./core/",
99
"js" : "./source/js",
1010
"images" : "./source/images",
1111
"fonts" : "./source/fonts",

core/lib/patternlab.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ var patternlab_engine = function (config) {
5757
function buildPatterns(deletePatternDir) {
5858
patternlab.data = fs.readJSONSync(path.resolve(paths.source.data, 'data.json'));
5959
patternlab.listitems = fs.readJSONSync(path.resolve(paths.source.data, 'listitems.json'));
60-
patternlab.header = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'pattern-header-footer/header.html'), 'utf8');
61-
patternlab.footer = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'pattern-header-footer/footer.html'), 'utf8');
60+
patternlab.header = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'source/_meta/header.html'), 'utf8');
61+
patternlab.footer = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'source/_meta/footer.html'), 'utf8');
6262
patternlab.patterns = [];
6363
patternlab.partials = {};
6464
patternlab.data.link = {};
@@ -212,7 +212,7 @@ var patternlab_engine = function (config) {
212212
}
213213

214214
//build the styleguide
215-
var styleguideTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'styleguide.mustache'), 'utf8'),
215+
var styleguideTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/styleguide.mustache'), 'utf8'),
216216
styleguideHtml = pattern_assembler.renderPattern(styleguideTemplate, {partials: styleguidePatterns});
217217

218218
fs.outputFileSync(path.resolve(paths.public.styleguide, 'html/styleguide.html'), styleguideHtml);
@@ -255,7 +255,7 @@ var patternlab_engine = function (config) {
255255
}
256256
}
257257

258-
var viewAllTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'viewall.mustache'), 'utf8');
258+
var viewAllTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/viewall.mustache'), 'utf8');
259259
var viewAllHtml = pattern_assembler.renderPattern(viewAllTemplate, {partials: viewAllPatterns, patternPartial: patternPartial});
260260
fs.outputFileSync(paths.public.patterns + pattern.subdir.slice(0, pattern.subdir.indexOf(pattern.patternGroup) + pattern.patternGroup.length) + '/index.html', viewAllHtml);
261261
}
@@ -282,14 +282,14 @@ var patternlab_engine = function (config) {
282282
}
283283
}
284284

285-
var viewAllTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'viewall.mustache'), 'utf8');
285+
var viewAllTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/viewall.mustache'), 'utf8');
286286
var viewAllHtml = pattern_assembler.renderPattern(viewAllTemplate, {partials: viewAllPatterns, patternPartial: patternPartial});
287287
fs.outputFileSync(paths.public.patterns + pattern.flatPatternPath + '/index.html', viewAllHtml);
288288
}
289289
}
290290

291291
//build the patternlab website
292-
var patternlabSiteTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'index.mustache'), 'utf8');
292+
var patternlabSiteTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/index.mustache'), 'utf8');
293293

294294
//loop through all patterns.to build the navigation
295295
//todo: refactor this someday
@@ -462,20 +462,20 @@ var patternlab_engine = function (config) {
462462

463463
//the patternlab site requires a lot of partials to be rendered.
464464
//patternNav
465-
var patternNavTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'partials/patternNav.mustache'), 'utf8');
465+
var patternNavTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/partials/patternNav.mustache'), 'utf8');
466466
var patternNavPartialHtml = pattern_assembler.renderPattern(patternNavTemplate, patternlab);
467467

468468
//ishControls
469-
var ishControlsTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'partials/ishControls.mustache'), 'utf8');
469+
var ishControlsTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/partials/ishControls.mustache'), 'utf8');
470470
patternlab.config.mqs = patternlab.mediaQueries;
471471
var ishControlsPartialHtml = pattern_assembler.renderPattern(ishControlsTemplate, patternlab.config);
472472

473473
//patternPaths
474-
var patternPathsTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'partials/patternPaths.mustache'), 'utf8');
474+
var patternPathsTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/partials/patternPaths.mustache'), 'utf8');
475475
var patternPathsPartialHtml = pattern_assembler.renderPattern(patternPathsTemplate, {'patternPaths': JSON.stringify(patternlab.patternPaths)});
476476

477477
//viewAllPaths
478-
var viewAllPathsTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'partials/viewAllPaths.mustache'), 'utf8');
478+
var viewAllPathsTemplate = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'templates/partials/viewAllPaths.mustache'), 'utf8');
479479
var viewAllPathsPartialHtml = pattern_assembler.renderPattern(viewAllPathsTemplate, {'viewallpaths': JSON.stringify(patternlab.viewAllPaths)});
480480

481481
//render the patternlab template, with all partials
File renamed without changes.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<!--sg-controls-->
2+
<div class="sg-controls" id="sg-controls">
3+
<div class="sg-control-content">
4+
<ul class="sg-control">
5+
<li class="sg-size">
6+
<div class="sg-current-size">
7+
<form id="sg-form">
8+
Size <input type="text" class="sg-input sg-size-px" value="---">px /
9+
<input type="text" class="sg-input sg-size-em" value="---">em
10+
</form><!--end #sg-form-->
11+
</div><!--end #sg-current-size-->
12+
<ul class="sg-acc-panel sg-size-options">
13+
{{# ishControlsVisible.s }}<li><a href="#" id="sg-size-s">S</a></li>{{/ ishControlsVisible.s }}
14+
{{# ishControlsVisible.m }}<li><a href="#" id="sg-size-m">M</a></li>{{/ ishControlsVisible.m }}
15+
{{# ishControlsVisible.l }}<li><a href="#" id="sg-size-l">L</a></li>{{/ ishControlsVisible.l }}
16+
{{# ishControlsVisible.full }}<li><a href="#" id="sg-size-full">Full</a></li>{{/ ishControlsVisible.full }}
17+
{{# ishControlsVisible.random }}<li><a href="#" id="sg-size-random">Random</a></li>{{/ ishControlsVisible.random }}
18+
{{# ishControlsVisible.disco }}<li><a href="#" class="mode-link" id="sg-size-disco">Disco</a></li>{{/ ishControlsVisible.disco }}
19+
{{# ishControlsVisible.hay }}<li><a href="#" class="mode-link" id="sg-size-hay">Hay!</a></li>{{/ ishControlsVisible.hay }}
20+
</ul>
21+
</li>
22+
{{# ishControlsVisible.mqs }}
23+
<li class="sg-mqs">
24+
<a href="#" class="mode-link sg-acc-handle" id="sg-size-mq" title="Media queries in stylesheet">MQ</a>
25+
<ul class="sg-acc-panel sg-left" id="sg-mq">
26+
{{# mqs }}
27+
<li><a href="#">{{ . }}</a></li>
28+
{{/ mqs }}
29+
</ul>
30+
</li>
31+
{{/ ishControlsVisible.mqs }}
32+
{{# ishControlsVisible.find }}
33+
<li class="sg-find">
34+
<a href="#" class="sg-acc-handle sg-control-trigger sg-icon sg-icon-search" id="sg-f-toggle" title="Search Patterns"><span class="is-vishidden">Search Patterns</span></a>
35+
<ul class="sg-view sg-acc-panel sg-right sg-checklist" id="sg-find" style="margin-top: 33px;">
36+
<li><input class="typeahead" id="typeahead" type="text" placeholder="search for a pattern..."></li>
37+
</ul>
38+
</li>
39+
{{/ ishControlsVisible.find }}
40+
{{# ishControlsVisible.views-all }}
41+
<li class="sg-view">
42+
<a href="#" class="sg-acc-handle sg-control-trigger sg-icon sg-icon-eye" id="sg-t-toggle" title="View"><span class="is-vishidden">View</span></a>
43+
<ul class="sg-view sg-acc-panel sg-right sg-checklist" id="sg-view">
44+
{{# ishControlsVisible.views-annotations }}<li><a href="#" class="sg-checkbox" id="sg-t-annotations">Annotations</a></li>{{/ ishControlsVisible.views-annotations }}
45+
{{# ishControlsVisible.views-code }}<li><a href="#" class="sg-checkbox" id="sg-t-code">Code</a></li>{{/ ishControlsVisible.views-code }}
46+
{{# ishControlsVisible.views-new }}<li><a href="#" target="_blank" id="sg-raw" class="sg-icon-link">Open in new window</a></li>{{/ ishControlsVisible.views-new }}
47+
</ul>
48+
</li>
49+
{{/ ishControlsVisible.views-all }}
50+
{{# ishControlsVisible.tools-all }}
51+
<li class="sg-tools">
52+
<a href="#" class="sg-acc-handle sg-tools-toggle sg-icon sg-icon-cog" id="sg-tools-toggle" title="Tools"><span class="is-vishidden">Tools</span></a>
53+
<ul class="sg-acc-panel sg-right sg-checklist">
54+
{{# ishControlsVisible.tools-sync }}<li><a href="http://localhost:3001" target="_blank" id="syncButton" class="sg-checkbox sg-auto-reload" data-state="off">BrowserSync UI</a></li>{{/ ishControlsVisible.tools-sync }}
55+
{{# ishControlsVisible.tools-shortcuts }}<li><a href="http://pattern-lab.info/docs/advanced-keyboard-shortcuts.html" class="sg-icon-keyboard" target="_blank">Keyboard Shortcuts</a>{{/ ishControlsVisible.tools-shortcuts }}
56+
{{# ishControlsVisible.tools-docs }}<li><a href="http://pattern-lab.info/docs/" class="sg-icon-file" target="_blank">Pattern Lab Docs</a>{{/ ishControlsVisible.tools-docs }}
57+
</ul>
58+
</li>
59+
{{/ ishControlsVisible.tools-all }}
60+
</ul>
61+
62+
</div>
63+
</div>
64+
<!--End #sg-controls-->
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<ol class="sg-nav">
2+
{{# buckets }}
3+
<li class="sg-nav-{{ bucketNameLC }}"><a class="sg-acc-handle">{{ bucketNameUC }}</a><ol class="sg-acc-panel">
4+
{{# navItems }}
5+
<li class="sg-nav-{{ sectionNameLC }}"><a class="sg-acc-handle">{{ sectionNameUC }}</a><ol class="sg-acc-panel">
6+
{{# navSubItems }}
7+
<li><a href="patterns/{{ patternPath }}" class="sg-pop {{# patternState }}sg-pattern-state {{ patternState }}{{/ patternState }}" data-patternpartial="{{ patternPartial }}">{{ patternName }}</a></li>
8+
{{/ navSubItems }}
9+
</ol></li>
10+
{{/ navItems }}
11+
{{# patternItems }}
12+
<li><a href="patterns/{{ patternPath }}" class="sg-pop {{# patternState }}sg-pattern-state {{ patternState }}{{/ patternState }}"" data-patternpartial="{{ patternPartial }}">{{ patternName }}</a></li>
13+
{{/ patternItems }}
14+
</ol></li>
15+
{{/ buckets }}
16+
<li><a href="styleguide/html/styleguide.html" class="sg-pop" data-patternpartial="all">All</a></li>
17+
</ol>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<script>
2+
var patternPaths = {{{ patternPaths }}}
3+
</script>

0 commit comments

Comments
 (0)