Skip to content

Commit 9487917

Browse files
committed
in process stylemodifier work
1 parent da94847 commit 9487917

File tree

4 files changed

+37
-13
lines changed

4 files changed

+37
-13
lines changed

builder/pattern_assembler.js

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/*
2-
* patternlab-node - v0.12.0 - 2015
3-
*
1+
/*
2+
* patternlab-node - v0.12.0 - 2015
3+
*
44
* Brian Muenzenmeyer, and the web community.
5-
* Licensed under the MIT license.
6-
*
7-
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
5+
* Licensed under the MIT license.
6+
*
7+
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
88
*
99
*/
1010

@@ -22,7 +22,6 @@
2222
return true;
2323
}
2424

25-
2625
//find and return any {{> template-name }} within pattern
2726
function findPartials(pattern){
2827
var matches = pattern.template.match(/{{>([ ])?([\w\-\.\/~]+)(?:\:[A-Za-z0-9-]+)?(?:(| )\(.*)?([ ])?}}/g);
@@ -42,6 +41,26 @@
4241
}
4342
}
4443

44+
function applyStyleModifications(pattern, patternlab){
45+
//look for styleModifiers within the pattern template
46+
var matches = pattern.template.match(/(:)([a-zA-Z]*)/g);
47+
48+
//parse matches if they look like modifiers
49+
if(matches){
50+
console.log(matches);
51+
52+
for(var i = 0; i < matches.length; i++){
53+
if(matches[i].length > 1){
54+
console.log(matches[i]);
55+
}
56+
}
57+
}
58+
59+
//add to pattern data
60+
61+
//remove from the template
62+
}
63+
4564
function addPattern(pattern, patternlab){
4665
patternlab.data.link[pattern.patternGroup + '-' + pattern.patternName] = '/patterns/' + pattern.patternLink;
4766
patternlab.patterns.push(pattern);
@@ -92,10 +111,12 @@
92111
try {
93112
var listJsonFileName = patternlab.config.patterns.source + currentPattern.subdir + '/' + currentPattern.fileName + ".listitems.json";
94113
currentPattern.patternSpecificListJson = fs.readJSONSync(listJsonFileName.substring(2));
95-
console.log('found pattern-specific listitems.json for ' + currentPattern.key);
114+
if(patternlab.confi.debug){
115+
console.log('found pattern-specific listitems.json for ' + currentPattern.key);
116+
}
96117
}
97118
catch(e) {
98-
}
119+
}
99120

100121
//add the raw template to memory
101122
currentPattern.template = fs.readFileSync(abspath, 'utf8');
@@ -145,6 +166,9 @@
145166

146167
}
147168

169+
//look for pattern styleModifiers
170+
applyStyleModifications(currentPattern, patternlab);
171+
148172
//find pattern lineage
149173
lineage_hunter.find_lineage(currentPattern, patternlab);
150174

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
},
66
"ignored-extensions" : ["scss", "DS_Store", "less"],
77
"ignored-directories" : ["scss"],
8-
"debug": false,
8+
"debug": true,
99
"ishControlsVisible": {
1010
"s": true,
1111
"m": true,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<li class="comment-container">
1+
<li class="comment-container {{ styleModifier }}">
22
<div class="comment-meta">
33
{{> atoms-avatar }}
44
<h4 class="comment-name"><a href="#">{{name.first}} {{name.last}}</a></h4>
55
</div>
66
<div class="comment-text">
77
<p>{{description}}</p>
88
</div>
9-
</li>
9+
</li>

source/_patterns/02-organisms/02-comments/01-sticky-comment.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="comments-container" id="comments-container">
33
<h2 class="section-title">Selected Comments</h2>
44
<ul class="comment-list">
5-
{{> molecules-single-comment(description: 'We are all in the gutter, but some of us are looking at the stars.') }}
5+
{{> molecules-single-comment:sticky(description: 'We are all in the gutter, but some of us are looking at the stars.') }}
66
{{> molecules-single-comment(description: 'A life is like a garden. Perfect moments can be had, but not preserved, except in memory.') }}
77
</ul>
88
</div>

0 commit comments

Comments
 (0)