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

Commit abf83e6

Browse files
committed
pages can be built from templates if needed. closes #5
had to remove an arbitrary limit. now supports the tactic @dmolsen outlined here: pattern-lab/patternlab-php#31
1 parent 5fb37c2 commit abf83e6

File tree

3 files changed

+8
-105
lines changed

3 files changed

+8
-105
lines changed

builder/patternlab.js

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ var patternlab_engine = function(){
130130
var cleanSub = sub.substring(0, folderIndex);
131131

132132
//add any templates found to an object of partials, so downstream templates may use them too
133-
//exclude the template patterns - we don't need them as partials because pages will just swap data
133+
//look for the full path on nested patters, else expect it to be flat
134+
var partialname = '';
134135
if(cleanSub !== ''){
135-
var partialname = cleanSub + '-' + patternName.substring(patternName.indexOf('-') + 1);
136-
137-
patternlab.partials[partialname] = currentPattern.template;
138-
139-
//done
136+
partialname = cleanSub + '-' + patternName.substring(patternName.indexOf('-') + 1);
137+
} else{
138+
partialname = currentPattern.patternGroup + '-' + patternName.substring(patternName.indexOf('-') + 1);
140139
}
140+
patternlab.partials[partialname] = currentPattern.template;
141141

142142
//add to patternlab arrays so we can look these up later. this could probably just be an object.
143143
patternlab.patternIndex.push(currentPattern.name);
@@ -160,9 +160,6 @@ var patternlab_engine = function(){
160160

161161
//write the encoded version too
162162
fs.outputFileSync('./public/patterns/' + pattern.patternLink.replace('.html', '.escaped.html'), entity_encoder.encode(pattern.patternPartial));
163-
164-
165-
166163
});
167164

168165
//export patterns if necessary
@@ -335,19 +332,11 @@ var patternlab_engine = function(){
335332
var viewAllPathsTemplate = fs.readFileSync('./source/_patternlab-files/partials/viewAllPaths.mustache', 'utf8');
336333
var viewAllPathersPartialHtml = renderPattern(viewAllPathsTemplate, {'viewallpaths': JSON.stringify(patternlab.viewAllPaths)});
337334

338-
//websockets
339-
var websocketsTemplate = fs.readFileSync('./source/_patternlab-files/partials/websockets.mustache', 'utf8');
340-
patternlab.contentsyncport = patternlab.config.contentSyncPort;
341-
patternlab.navsyncport = patternlab.config.navSyncPort;
342-
343-
var websocketsPartialHtml = renderPattern(websocketsTemplate, patternlab);
344-
345335
//render the patternlab template, with all partials
346336
var patternlabSiteHtml = renderPattern(patternlabSiteTemplate, {}, {
347337
'ishControls': ishControlsPartialHtml,
348338
'patternNav': patternNavPartialHtml,
349339
'patternPaths': patternPathsPartialHtml,
350-
'websockets': websocketsPartialHtml,
351340
'viewAllPaths': viewAllPathersPartialHtml
352341
});
353342
fs.outputFileSync('./public/index.html', patternlabSiteHtml);
Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1 @@
1-
<div class="page" id="page">
2-
{{> organisms-header }}
3-
<div role="main">
4-
5-
{{# hero }}
6-
{{> molecules-block-hero }}
7-
{{/ hero}}
8-
9-
<div class="g g-3up">
10-
{{# touts}}
11-
<div class="gi">
12-
{{> molecules-inset-block }}
13-
</div>
14-
{{/ touts}}
15-
</div><!--end 3up-->
16-
17-
<hr />
18-
19-
<div class="l-two-col">
20-
<div class="l-main">
21-
<section class="section latest-posts">
22-
<h2 class="section-title">Latest Posts</h2>
23-
<ul class="post-list">
24-
{{# latest-posts}}
25-
<li>{{> molecules-media-block }}</li>
26-
{{/ latest-posts}}
27-
</ul>
28-
<a href="#" class="text-btn">View more posts</a>
29-
</section>
30-
</div>
31-
32-
<div class="l-sidebar">
33-
{{> organisms-recent-tweets }}
34-
</div><!--end l-sidebar-->
35-
</div><!--End role=main-->
36-
{{> organisms-footer }}
37-
</div>
1+
{{> templates-homepage }}
Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1 @@
1-
<div class="page" id="page">
2-
{{> organisms-header }}
3-
<div role="main">
4-
<div class="l-two-col">
5-
<div class="l-main">
6-
<article class="article">
7-
<header class="article-header">
8-
<h1>Top 10 Trails You Have To Hike Before You Die</h1>
9-
{{> molecules-byline-author-time }}
10-
</header>
11-
<p class="intro">This is where a post about hiking trails would live. I'm not going to write an article about hiking trails. That would take a lot of time.</p>
12-
13-
<p><a href="#">This is a link, possibly to an external resource.</a> In a post about hiking trails, there would probably be talk about how to get to featured trails, what to pack, where to camp, and so on and so forth. I don't have any expertise in this subject matter so I'm not going to attempt to write about it.</p>
14-
15-
{{> atoms-landscape-16x9 }}
16-
17-
<p>If I were to write about it, I'd probably do some research on the topic first. But even then, I probably Sed a orci turpis. Aliquam aliquet placerat dui, consectetur tincidunt leo tristique et. Vivamus enim nisi, blandit a venenatis quis, convallis et arcu. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris libero sapien, placerat in sodales eu, tempor quis dui. Vivamus egestas faucibus pulvinar. Maecenas eget diam nunc. Phasellus at sem eros, ac suscipit neque. Phasellus sollicitudin libero a odio dignissim scelerisque. Aliquam purus nulla, tempor eget ullamcorper quis, rhoncus non dui.
18-
</p>
19-
20-
<blockquote>
21-
This trail is amazing. I've never seen anything like it.
22-
</blockquote>
23-
24-
<p>Cras at fringilla ipsum. Donec nec libero eget est blandit dignissim a eu ante. Morbi augue nulla, luctus eu sagittis vel, malesuada ut felis. Aliquam erat volutpat. Morbi malesuada augue ac massa hendrerit fermentum. Integer scelerisque lacus a dolor convallis lobortis. Curabitur mollis ante in massa ultricies dignissim.
25-
</p>
26-
27-
{{> atoms-unordered }}
28-
29-
{{> atoms-ordered }}
30-
31-
<p>Donec posuere fringilla nunc, vitae venenatis diam scelerisque vel. Nullam vitae mauris magna. Mauris et diam quis justo volutpat tincidunt congue nec magna. Curabitur vitae orci elit. Ut mollis massa id magna vestibulum consequat. Proin rutrum lectus justo, sit amet tincidunt est. Vivamus vitae lacinia risus.
32-
</p>
33-
34-
{{> molecules-pullquote }}
35-
36-
<p>Donec venenatis imperdiet tortor, vitae blandit odio interdum ut. Integer orci metus, lobortis id lacinia eget, rutrum vitae justo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In pretium fermentum justo nec pharetra. Maecenas eget dapibus justo. Ut quis est risus. Nullam et eros at odio commodo venenatis quis et augue. Sed sed augue at tortor porttitor hendrerit nec ut nibh. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin sollicitudin enim consectetur mi commodo quis cursus ante pretium. Nunc gravida cursus nisi in gravida. Suspendisse eget tortor sed urna consequat tincidunt. Etiam eget convallis lectus. Suspendisse cursus rutrum massa ac faucibus.
37-
</p>
38-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reiciendis, suscipit repellendus nulla accusantium deserunt sed explicabo voluptate sapiente ratione inventore molestiae nihil earum repellat quia odit vitae perspiciatis aliquam amet?</p>
39-
</article><!--end .article-->
40-
{{> molecules-social-share }}
41-
{{> organisms-comment-thread }}
42-
</div><!--end l-main-->
43-
44-
<div class="l-sidebar">
45-
{{> organisms-related-posts }}
46-
{{> organisms-recent-tweets }}
47-
</div><!--end l-sidebar-->
48-
</div><!--end l-two-col-->
49-
</div><!--End role=main-->
50-
{{> organisms-footer }}
51-
</div>
1+
{{> templates-article }}

0 commit comments

Comments
 (0)