Skip to content

Commit

Permalink
feat: add singleFile param
Browse files Browse the repository at this point in the history
Add singleFile param to output all in
one html file

asyncapi#61
  • Loading branch information
GordeevArt committed Sep 11, 2020
1 parent c795802 commit e4c1813
Show file tree
Hide file tree
Showing 5 changed files with 1,993 additions and 2,385 deletions.
25 changes: 25 additions & 0 deletions hooks/01_removeNotRelevantParts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const fs = require('fs');
const path = require('path');

module.exports = {
'generate:after': generator => {

const params = generator.templateParams;
const singleFile = params.singleFile === 'true';

if (singleFile) {

const jsDir = path.resolve(generator.targetDir, 'js');
const cssDir = path.resolve(generator.targetDir, 'css');

const callback = (error) => {
if (error) {
throw error;
}
};

fs.rmdir(jsDir, {recursive: true}, callback);
fs.rmdir(cssDir, {recursive: true}, callback);
}
}
};
Loading

0 comments on commit e4c1813

Please sign in to comment.