Skip to content

Commit 19b0cce

Browse files
committed
Add a configuration option to export all patterns.
1 parent f0fe98b commit 19b0cce

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

core/lib/pattern_exporter.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ var pattern_exporter = function () {
1414
function exportPatterns(patternlab) {
1515
//read the config export options
1616
var exportPartials = patternlab.config.patternExportPatternPartials;
17+
var exportAll = patternlab.config.patternExportAll;
18+
19+
if (exportAll) {
20+
for (var i = 0; i < patternlab.patterns.length; i++) {
21+
if (!patternlab.patterns[i].patternPartial.startsWith('-')) {
22+
fs.outputFileSync(patternlab.config.patternExportDirectory + patternlab.patterns[i].patternPartial + '.html', patternlab.patterns[i].patternPartialCode);
23+
}
24+
}
25+
26+
return;
27+
}
1728

1829
//find the chosen patterns to export
1930
for (var i = 0; i < exportPartials.length; i++) {

patternlab-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"patternStateCascade": ["inprogress", "inreview", "complete"],
5353
"patternStates": {
5454
},
55+
"patternExportAll": false,
5556
"patternExportPatternPartials": [],
5657
"patternExportDirectory": "./pattern_exports/",
5758
"cacheBust": true,

0 commit comments

Comments
 (0)