Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
shailen-naidoo committed Jul 29, 2019
1 parent af31987 commit 84fa6bd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

<!DOCTYPE html>
<html>
<head>
<title>Hydrogen</title>
</head>
<body>
<p>Hydrogen: Static-site generator</p>
</body>
</html>
19 changes: 19 additions & 0 deletions docs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const page = ({ title, text, dev }) => `
<!DOCTYPE html>
<html>
<head>
<title>${title}</title>
</head>
<body>
<p>${text}</p>
</body>
</html>
`;

module.exports = {
title: 'Hydrogen',
page,
data: () => ({
text: 'Hydrogen: Static-site generator',
}),
};
2 changes: 2 additions & 0 deletions src/generator/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ export const tempateGenerator = async (filename: string): Promise<void|boolean>
return false;
}

console.time('build time');
const file = await import(`${CWD}/${filename}`);
await fs.outputFile(filename.replace('.js', '.html'), await file.page({ title: file.title, ...file.data ? await file.data() : {} }));
console.timeEnd('build time');
};

// @ts-ignore
Expand Down

0 comments on commit 84fa6bd

Please sign in to comment.