Skip to content

Commit d977b18

Browse files
committed
Support for ignoring _directories
Resolves #128
1 parent 1d0fd0b commit d977b18

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
THIS CHANGELOG IS AN ATTEMPT TO DOCUMENT CHANGES TO THIS PROJECT.
2+
3+
PL-node-v0.11.0
4+
- ADD: Ignore pattern directories that start with an underscore.
5+
26
PL-node-v0.10.1
37
- ADD: Added more unit tests for recently more-modular code
48
- FIX: Lineage was not working for patterns with pattern parameters

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ If your instance of Pattern Lab lives in a subdirectory of your server, for inst
177177

178178
Default: blank
179179

180+
##### excluding patterns
181+
182+
If you'd like to exclude an individual pattern you can do so by prepending the filename with an underscore, like: `_filename.mustache`
183+
184+
You can also exclude complete directories by prepending the directory name with an underscore, like: `/_experiment/...`
185+
180186
##### Verbose Mode
181187
`patternlab.json` is a file created for debugging purposes. Set `debug` to true in `.config.json` to see all the secrets.
182188

builder/patternlab.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,27 @@ var patternlab_engine = function () {
6565

6666
var pattern_assembler = new pa(),
6767
entity_encoder = new he(),
68-
pattern_exporter = new pe();
69-
70-
diveSync('./source/_patterns', function(err, file){
71-
//log any errors
72-
if(err){
73-
console.log(err);
74-
return;
75-
}
76-
77-
pattern_assembler.process_pattern_file(file, patternlab);
68+
pattern_exporter = new pe(),
69+
patterns_dir = './source/_patterns';
70+
71+
diveSync(patterns_dir, {
72+
filter: function(path, dir) {
73+
if(dir){
74+
var remainingPath = path.replace(patterns_dir, '');
75+
var isValidPath = remainingPath.indexOf('/_') === -1;
76+
return isValidPath;
77+
}
78+
return true;
79+
}
80+
},
81+
function(err, file){
82+
//log any errors
83+
if(err){
84+
console.log(err);
85+
return;
86+
}
7887

88+
pattern_assembler.process_pattern_file(file, patternlab);
7989
});
8090
//render all patterns last, so lineageR works
8191
patternlab.patterns.forEach(function(pattern, index, patterns){

0 commit comments

Comments
 (0)