Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions bin/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,17 @@ async function generator(configFilename, distPath, opt){

// write content to file
await _fs.writeFile(_path.join(distPath, templateVars.scheme), content, 'utf8');

console.log(` |- Page <${templateVars.scheme}>`);

const jsonContent = {
"status": Number(templateVars.code),
"title": templateVars.title,
"detail": templateVars.message
}

await _fs.writeFile(_path.join(distPath, templateVars.baseScheme) + '.json', JSON.stringify(jsonContent, null, 4), 'utf8');
console.log(` |- Page <${templateVars.baseScheme}.json>`);

}));
}

Expand Down Expand Up @@ -131,4 +140,4 @@ _cli.parse(process.argv);
// default action (no command provided)
if (!process.argv.slice(2).length) {
_cli.outputHelp();
}
}
3 changes: 2 additions & 1 deletion config-dist.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
// Output Filename Scheme - eg. HTTP500.html
"scheme": "HTTP%code%.html",
"baseScheme": "HTTP%code%",

// Page title (HTML not allowed)
"pagetitle": "We've got some trouble | %code% - %title%",

// Footer content (HTML Allowed)
"footer": null
}
}
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
// Output Filename Scheme - eg. HTTP500.html
"scheme": "HTTP%code%.html",
"baseScheme": "HTTP%code%",

// Page title (HTML not allowed)
"pagetitle": "We've got some trouble | %code% - %title%",
Expand All @@ -10,4 +11,4 @@

// additional vars
"myvar" : "Hello World"
}
}