Skip to content

Commit

Permalink
keeping the data from underscore-prefixed files, but ignoring in nav
Browse files Browse the repository at this point in the history
  • Loading branch information
e2tha-e committed Oct 3, 2015
1 parent 9e1fc5d commit 34793f5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 6 additions & 4 deletions builder/pattern_assembler.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
var filename = path.basename(file);
var ext = path.extname(filename);

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

Expand Down Expand Up @@ -145,14 +145,16 @@
pseudopattern_hunter = new pph();

//find current pattern in patternlab object using var file as a key
var currentPattern, i;
var currentPattern,
i;

for(i = 0; i < patternlab.patterns.length; i++){
if(patternlab.patterns[i].abspath === file){
currentPattern = patternlab.patterns[i];
}
}

//return if processing a non-variant .json file
//return if processing an ignored file
if(typeof currentPattern === 'undefined'){
return;
}
Expand Down
10 changes: 10 additions & 0 deletions builder/patternlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ var patternlab_engine = function () {
i;

for (i = 0; i < patternlab.patterns.length; i++) {
// skip underscore-prefixed files
if (path.basename(patternlab.patterns[i].abspath).charAt(0) === '_') {
continue;
}

var pattern = patternlab.patterns[i];

// check if the current sub section is different from the previous one
Expand Down Expand Up @@ -193,6 +198,11 @@ var patternlab_engine = function () {
//loop through all patterns.to build the navigation
//todo: refactor this someday
for(var i = 0; i < patternlab.patterns.length; i++){
// skip underscore-prefixed files
if (path.basename(patternlab.patterns[i].abspath).charAt(0) === '_') {
continue;
}

var pattern = patternlab.patterns[i];
var bucketName = pattern.name.replace(/\\/g, '-').split('-')[1];

Expand Down

0 comments on commit 34793f5

Please sign in to comment.