Skip to content

Commit bd8b602

Browse files
committed
If the user-editable header and footer are not found, print a descriptive error
message and exit immediately.
1 parent 6230849 commit bd8b602

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

core/lib/patternlab.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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)