Skip to content

Commit 9b16f26

Browse files
committed
Specify template files via configuration
closes #683
1 parent 7a9994c commit 9b16f26

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

core/lib/patternlab.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,11 +541,11 @@ const patternlab_engine = function (config) {
541541
patternlab.listitems = {};
542542
}
543543
try {
544-
patternlab.header = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'partials', 'general-header.mustache'), 'utf8');
545-
patternlab.footer = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'partials', 'general-footer.mustache'), 'utf8');
546-
patternlab.patternSection = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'partials', 'patternSection.mustache'), 'utf8');
547-
patternlab.patternSectionSubType = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'partials', 'patternSectionSubtype.mustache'), 'utf8');
548-
patternlab.viewAll = fs.readFileSync(path.resolve(paths.source.patternlabFiles, 'viewall.mustache'), 'utf8');
544+
patternlab.header = fs.readFileSync(path.resolve(paths.source.patternlabFiles['general-header']), 'utf8');
545+
patternlab.footer = fs.readFileSync(path.resolve(paths.source.patternlabFiles['general-footer']), 'utf8');
546+
patternlab.patternSection = fs.readFileSync(path.resolve(paths.source.patternlabFiles.patternSection), 'utf8');
547+
patternlab.patternSectionSubType = fs.readFileSync(path.resolve(paths.source.patternlabFiles.patternSectionSubtype), 'utf8');
548+
patternlab.viewAll = fs.readFileSync(path.resolve(paths.source.patternlabFiles.viewall), 'utf8');
549549
} catch (ex) {
550550
console.log(ex);
551551
plutils.error('\nERROR: missing an essential file from ' + paths.source.patternlabFiles + '. Pattern Lab won\'t work without this file.\n');

test/util/patternlab-config.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
"data" : "./test/files/_data/",
77
"meta": "./test/files/_meta/",
88
"styleguide" : "./test/files/styleguide/",
9-
"patternlabFiles" : "./test/files/",
9+
"patternlabFiles" : {
10+
"general-header": "./test/files/partials/general-header.mustache",
11+
"general-footer": "./test/files/partials/general-footer.mustache",
12+
"patternSection": "./test/files/partials/patternSection.mustache",
13+
"patternSectionSubtype": "./test/files/partials/patternSectionSubtype.mustache",
14+
"viewall": "./test/files/viewall.mustache"
15+
},
1016
"js" : "./test/files/js",
1117
"images" : "./test/files/images",
1218
"fonts" : "./test/files/fonts",

0 commit comments

Comments
 (0)