Skip to content

Commit 047c9bb

Browse files
Merge pull request #420 from pattern-lab/missing-header-footer-warning
Missing user-editable header / footer error handling.
2 parents dd2bca1 + bd8b602 commit 047c9bb

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

core/lib/patternlab.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/*
2-
* patternlab-node - v2.3.0 - 2016
3-
*
1+
/*
2+
* patternlab-node - v2.3.0 - 2016
3+
*
44
* Brian Muenzenmeyer, Geoff Pursell, and the web community.
5-
* Licensed under the MIT license.
6-
*
7-
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
5+
* Licensed under the MIT license.
6+
*
7+
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
88
*
99
*/
1010

@@ -244,19 +244,17 @@ var patternlab_engine = function (config) {
244244
patternlab.userHead = fs.readFileSync(path.resolve(paths.source.meta, '_00-head.mustache'), 'utf8');
245245
}
246246
catch (ex) {
247-
if (patternlab.config.debug) {
248-
console.log(ex);
249-
console.log('Could not find optional user-defined header, usually found at ./source/_meta/_00-head.mustache. It was likely deleted.');
250-
}
247+
console.log('\nWARNING: Could not find the user-editable header template, currently configured to be at ' + path.join(config.paths.source.meta, '_00-head.mustache') + '. Your configured path may be incorrect (check paths.source.meta in your config file), the file may have been deleted, or it may have been left in the wrong place during a migration or update.\n');
248+
if (patternlab.config.debug) { console.log(ex); }
249+
process.exit(1);
251250
}
252251
try {
253252
patternlab.userFoot = fs.readFileSync(path.resolve(paths.source.meta, '_01-foot.mustache'), 'utf8');
254253
}
255254
catch (ex) {
256-
if (patternlab.config.debug) {
257-
console.log(ex);
258-
console.log('Could not find optional user-defined footer, usually found at ./source/_meta/_01-foot.mustache. It was likely deleted.');
259-
}
255+
console.log('\nWARNING: Could not find the user-editable footer template, currently configured to be at ' + path.join(config.paths.source.meta, '_01-foot.mustache') + '. Your configured path may be incorrect (check paths.source.meta in your config file), the file may have been deleted, or it may have been left in the wrong place during a migration or update.\n');
256+
if (patternlab.config.debug) { console.log(ex); }
257+
process.exit(1);
260258
}
261259

262260
//now that all the main patterns are known, look for any links that might be within data and expand them

0 commit comments

Comments
 (0)