Skip to content

Commit 34793f5

Browse files
author
e2tha-e
committed
keeping the data from underscore-prefixed files, but ignoring in nav
1 parent 9e1fc5d commit 34793f5

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

builder/pattern_assembler.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@
8383
var filename = path.basename(file);
8484
var ext = path.extname(filename);
8585

86-
//ignore _underscored patterns, dotfiles, and non-variant .json files
87-
if(filename.charAt(0) === '_' || filename.charAt(0) === '.' || (ext === '.json' && filename.indexOf('~') === -1)){
86+
//ignore dotfiles and non-variant .json files
87+
if(filename.charAt(0) === '.' || (ext === '.json' && filename.indexOf('~') === -1)){
8888
return;
8989
}
9090

@@ -145,14 +145,16 @@
145145
pseudopattern_hunter = new pph();
146146

147147
//find current pattern in patternlab object using var file as a key
148-
var currentPattern, i;
148+
var currentPattern,
149+
i;
150+
149151
for(i = 0; i < patternlab.patterns.length; i++){
150152
if(patternlab.patterns[i].abspath === file){
151153
currentPattern = patternlab.patterns[i];
152154
}
153155
}
154156

155-
//return if processing a non-variant .json file
157+
//return if processing an ignored file
156158
if(typeof currentPattern === 'undefined'){
157159
return;
158160
}

builder/patternlab.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ var patternlab_engine = function () {
165165
i;
166166

167167
for (i = 0; i < patternlab.patterns.length; i++) {
168+
// skip underscore-prefixed files
169+
if (path.basename(patternlab.patterns[i].abspath).charAt(0) === '_') {
170+
continue;
171+
}
172+
168173
var pattern = patternlab.patterns[i];
169174

170175
// check if the current sub section is different from the previous one
@@ -193,6 +198,11 @@ var patternlab_engine = function () {
193198
//loop through all patterns.to build the navigation
194199
//todo: refactor this someday
195200
for(var i = 0; i < patternlab.patterns.length; i++){
201+
// skip underscore-prefixed files
202+
if (path.basename(patternlab.patterns[i].abspath).charAt(0) === '_') {
203+
continue;
204+
}
205+
196206
var pattern = patternlab.patterns[i];
197207
var bucketName = pattern.name.replace(/\\/g, '-').split('-')[1];
198208

0 commit comments

Comments
 (0)