Skip to content

Commit

Permalink
refactor: improve HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Apr 2, 2021
1 parent 5fcb302 commit 3afffa3
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 116 deletions.
19 changes: 12 additions & 7 deletions lib/utils/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,23 @@ function routes(server) {

statsForPrint.forEach((item, index) => {
res.write('<div>');
res.write(
`<h2>Compilation: '${item.name || `unnamed[${index}]`}'</h2>`
);

const name =
item.name || (stats.stats ? `unnamed[${index}]` : 'unnamed');

res.write(`<h2>Compilation: ${name}</h2>`);
res.write('<ul>');

const publicPath = item.publicPath === 'auto' ? '' : item.publicPath;

for (const assets of item.assets) {
for (const asset of item.assets) {
const assetName = asset.name;
const assetURL = `${publicPath}${assetName}`;

res.write(
`<li><a href="${publicPath + assets.name}" target="_blank">${
assets.name
}</a></li>`
`<li>
<strong><a href="${assetURL}" target="_blank">${assetName}</a></strong>
</li>`
);
}

Expand Down

0 comments on commit 3afffa3

Please sign in to comment.